diff --git a/.github/workflows/streaming_parity_gate.yml b/.github/workflows/streaming_parity_gate.yml new file mode 100644 index 0000000000..709303e93c --- /dev/null +++ b/.github/workflows/streaming_parity_gate.yml @@ -0,0 +1,28 @@ +# Streaming-parity gate — the measured-not-guessed guard (Path-to-100 step 6). +# Pure-Python, path-filtered to the parity tooling: it does NOT build NebulaStream +# and never runs on a normal C++ PR. It checks the committed feed for an L3 +# callability regression and an over-claim (a "100%" callability statement while +# the gap list is non-empty). Re-measuring the full surface needs the JMEOS jar + +# libmeos and is run out-of-band (see tools/streaming_parity/feeds/README.md). +name: streaming-parity gate + +on: + pull_request: + paths: + - 'tools/streaming_parity/**' + - 'doc/methodology/streaming_parity*' + push: + paths: + - 'tools/streaming_parity/**' + - 'doc/methodology/streaming_parity*' + +jobs: + gate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: streaming-parity gate (no L3 regression, no over-claim) + run: python3 tools/streaming_parity/ci_gate.py diff --git a/Input/input_berlinmod.csv b/Input/input_berlinmod.csv new file mode 100644 index 0000000000..753a68124b --- /dev/null +++ b/Input/input_berlinmod.csv @@ -0,0 +1,21 @@ +1735711200,100,4.3517,50.8503 +1735711200,300,4.2000,50.7500 +1735711201,200,4.3060,50.8270 +1735711202,100,4.3517,50.8503 +1735711202,300,4.2000,50.7500 +1735711203,200,4.3060,50.8270 +1735711204,100,4.3517,50.8503 +1735711204,300,4.2000,50.7500 +1735711205,200,4.3060,50.8270 +1735711206,100,4.3517,50.8503 +1735711206,300,4.2000,50.7500 +1735711207,200,4.3060,50.8270 +1735711208,100,4.3517,50.8503 +1735711208,300,4.2000,50.7500 +1735711209,200,4.3060,50.8270 +1735711210,100,4.3517,50.8503 +1735711210,300,4.2000,50.7500 +1735711211,200,4.3060,50.8270 +1735711212,100,4.3517,50.8503 +1735711212,300,4.2000,50.7500 +1735711213,200,4.3060,50.8270 diff --git a/Queries/berlinmod/q1_continuous.yaml b/Queries/berlinmod/q1_continuous.yaml new file mode 100644 index 0000000000..49786049e8 --- /dev/null +++ b/Queries/berlinmod/q1_continuous.yaml @@ -0,0 +1,47 @@ +# BerlinMOD-Q1 — continuous form +# "Which vehicles have appeared in the stream?" +# Per 1-second sliding bucket: emit (start, end, vehicle_id, event-count-in-bucket). +# Reading N rows over consecutive buckets enumerates the distinct-vehicles-seen set. + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events + FROM berlinmod_stream + GROUP BY vehicle_id + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q1_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q1_snapshot.yaml b/Queries/berlinmod/q1_snapshot.yaml new file mode 100644 index 0000000000..4fa9c05d63 --- /dev/null +++ b/Queries/berlinmod/q1_snapshot.yaml @@ -0,0 +1,46 @@ +# BerlinMOD-Q1 — snapshot form +# "At each 5-second tick, list of distinct vehicles seen in the tick window." +# Streaming approximation of the batch BerlinMOD-Q1 snapshot at time T. + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events + FROM berlinmod_stream + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q1_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q1_windowed.yaml b/Queries/berlinmod/q1_windowed.yaml new file mode 100644 index 0000000000..2d25214d24 --- /dev/null +++ b/Queries/berlinmod/q1_windowed.yaml @@ -0,0 +1,46 @@ +# BerlinMOD-Q1 — windowed form +# "Per 10-second tumbling window, distinct vehicles seen." +# Emits one row per (window, vehicle) seen; reading N rows per window = distinctCount. + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events + FROM berlinmod_stream + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q1_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q2_continuous.yaml b/Queries/berlinmod/q2_continuous.yaml new file mode 100644 index 0000000000..1d89420d19 --- /dev/null +++ b/Queries/berlinmod/q2_continuous.yaml @@ -0,0 +1,44 @@ +# BerlinMOD-Q2 — continuous form +# "Where is vehicle X (= 200) right now?" +# Per 1-second sliding bucket, emit a trajectory snippet for vehicle X. + +query: | + SELECT start, + end, + TEMPORAL_SEQUENCE(gps_lon, gps_lat, time_utc) AS trajectory + FROM berlinmod_stream + WHERE vehicle_id = UINT64(200) + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$TRAJECTORY, type: VARSIZED } + config: + file_path: "/workspace/Output/output_berlinmod_q2_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q2_snapshot.yaml b/Queries/berlinmod/q2_snapshot.yaml new file mode 100644 index 0000000000..af0946bb57 --- /dev/null +++ b/Queries/berlinmod/q2_snapshot.yaml @@ -0,0 +1,43 @@ +# BerlinMOD-Q2 — snapshot form +# "At each 5-second tick, snapshot of vehicle X's (= 200) trajectory in the tick." + +query: | + SELECT start, + end, + TEMPORAL_SEQUENCE(gps_lon, gps_lat, time_utc) AS trajectory + FROM berlinmod_stream + WHERE vehicle_id = UINT64(200) + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$TRAJECTORY, type: VARSIZED } + config: + file_path: "/workspace/Output/output_berlinmod_q2_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q2_windowed.yaml b/Queries/berlinmod/q2_windowed.yaml new file mode 100644 index 0000000000..d2ae83bc8c --- /dev/null +++ b/Queries/berlinmod/q2_windowed.yaml @@ -0,0 +1,43 @@ +# BerlinMOD-Q2 — windowed form +# "Per 10-second tumbling window, trajectory of vehicle X (= 200)." + +query: | + SELECT start, + end, + TEMPORAL_SEQUENCE(gps_lon, gps_lat, time_utc) AS trajectory + FROM berlinmod_stream + WHERE vehicle_id = UINT64(200) + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$TRAJECTORY, type: VARSIZED } + config: + file_path: "/workspace/Output/output_berlinmod_q2_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q3_continuous.yaml b/Queries/berlinmod/q3_continuous.yaml new file mode 100644 index 0000000000..bfae2d7c81 --- /dev/null +++ b/Queries/berlinmod/q3_continuous.yaml @@ -0,0 +1,49 @@ +# BerlinMOD-Q3 — continuous form +# "Vehicles within 5 km of Brussels city centre, right now." +# Per 1-second sliding bucket, emit (start, end, vehicle_id) for events near P. + +query: | + SELECT start, + end, + vehicle_id + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(5000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q3_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q3_snapshot.yaml b/Queries/berlinmod/q3_snapshot.yaml new file mode 100644 index 0000000000..673373d1ea --- /dev/null +++ b/Queries/berlinmod/q3_snapshot.yaml @@ -0,0 +1,50 @@ +# BerlinMOD-Q3 — snapshot form +# "At each 5-second tick, distinct vehicles within 5 km of P." + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events_near_p + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(5000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS_NEAR_P, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q3_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q3_windowed.yaml b/Queries/berlinmod/q3_windowed.yaml new file mode 100644 index 0000000000..3d54f1aa75 --- /dev/null +++ b/Queries/berlinmod/q3_windowed.yaml @@ -0,0 +1,50 @@ +# BerlinMOD-Q3 — windowed form +# "Per 10-second tumbling window, distinct vehicles within 5 km of P." + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events_near_p + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(5000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS_NEAR_P, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q3_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q4_continuous.yaml b/Queries/berlinmod/q4_continuous.yaml new file mode 100644 index 0000000000..03b1e852e9 --- /dev/null +++ b/Queries/berlinmod/q4_continuous.yaml @@ -0,0 +1,49 @@ +# BerlinMOD-Q4 — continuous form +# "Vehicles currently inside region R (Brussels centre rectangle)." +# R encoded as polygon; edwithin with d=0 ≡ "inside the polygon". + +query: | + SELECT start, + end, + vehicle_id + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POLYGON((4.30 50.84, 4.36 50.84, 4.36 50.86, 4.30 50.86, 4.30 50.84))', + FLOAT64(0.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q4_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q4_snapshot.yaml b/Queries/berlinmod/q4_snapshot.yaml new file mode 100644 index 0000000000..f9042070b1 --- /dev/null +++ b/Queries/berlinmod/q4_snapshot.yaml @@ -0,0 +1,50 @@ +# BerlinMOD-Q4 — snapshot form +# "At each 5-second tick, distinct vehicles inside region R." + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events_in_r + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POLYGON((4.30 50.84, 4.36 50.84, 4.36 50.86, 4.30 50.86, 4.30 50.84))', + FLOAT64(0.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS_IN_R, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q4_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q4_windowed.yaml b/Queries/berlinmod/q4_windowed.yaml new file mode 100644 index 0000000000..17162eafbb --- /dev/null +++ b/Queries/berlinmod/q4_windowed.yaml @@ -0,0 +1,51 @@ +# BerlinMOD-Q4 — windowed form +# "Per 10-second tumbling window, distinct vehicles inside region R." +# Intra-window scoping: a vehicle present inside R during the window is reported. + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events_in_r + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POLYGON((4.30 50.84, 4.36 50.84, 4.36 50.86, 4.30 50.86, 4.30 50.84))', + FLOAT64(0.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS_IN_R, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q4_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q5_continuous.yaml b/Queries/berlinmod/q5_continuous.yaml new file mode 100644 index 0000000000..8287754a03 --- /dev/null +++ b/Queries/berlinmod/q5_continuous.yaml @@ -0,0 +1,51 @@ +# BerlinMOD-Q5 — continuous form (FULL) +# "Pairs of vehicles meeting near P." Per-second sliding window over the events +# pre-filtered by upstream edwithin_tgeo_geo to the near-P set; the +# PAIR_MEETING aggregation enumerates pairs of vehicles inside the window and +# emits the BerlinMOD-Q5 answer directly (vid_a, vid_b, ts, "<=dMeet" tag) +# with dMeet = 200 m passed as the explicit fifth aggregation argument. + +query: | + SELECT start, + end, + PAIR_MEETING(gps_lon, gps_lat, time_utc, vehicle_id, 200.0) AS meeting_pairs + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(2000.0)) = INT32(1) + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$MEETING_PAIRS, type: VARSIZED } + config: + file_path: "/workspace/Output/output_berlinmod_q5_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q5_snapshot.yaml b/Queries/berlinmod/q5_snapshot.yaml new file mode 100644 index 0000000000..7eb2276e43 --- /dev/null +++ b/Queries/berlinmod/q5_snapshot.yaml @@ -0,0 +1,50 @@ +# BerlinMOD-Q5 — snapshot form (FULL) +# "Pairs of vehicles meeting near P." Per-5s tumbling-tick window over the +# events pre-filtered by upstream edwithin_tgeo_geo to the near-P set; +# PAIR_MEETING emits the per-tick meeting pairs as a VARSIZED string. The +# snapshot at time T equals the batch BerlinMOD-Q5 result up to T. + +query: | + SELECT start, + end, + PAIR_MEETING(gps_lon, gps_lat, time_utc, vehicle_id, 200.0) AS meeting_pairs + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(2000.0)) = INT32(1) + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$MEETING_PAIRS, type: VARSIZED } + config: + file_path: "/workspace/Output/output_berlinmod_q5_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q5_windowed.yaml b/Queries/berlinmod/q5_windowed.yaml new file mode 100644 index 0000000000..66fec0814d --- /dev/null +++ b/Queries/berlinmod/q5_windowed.yaml @@ -0,0 +1,50 @@ +# BerlinMOD-Q5 — windowed form (FULL) +# "Pairs of vehicles meeting near P." Per-10s tumbling window over the events +# pre-filtered by upstream edwithin_tgeo_geo to the near-P set; PAIR_MEETING +# emits the per-window meeting pairs (vid_a, vid_b, ts, "<=dMeet" tag) with +# dMeet = 200 m passed as the explicit fifth aggregation argument. + +query: | + SELECT start, + end, + PAIR_MEETING(gps_lon, gps_lat, time_utc, vehicle_id, 200.0) AS meeting_pairs + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(2000.0)) = INT32(1) + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$MEETING_PAIRS, type: VARSIZED } + config: + file_path: "/workspace/Output/output_berlinmod_q5_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q6_continuous.yaml b/Queries/berlinmod/q6_continuous.yaml new file mode 100644 index 0000000000..7b13911408 --- /dev/null +++ b/Queries/berlinmod/q6_continuous.yaml @@ -0,0 +1,48 @@ +# BerlinMOD-Q6 — continuous form (FULL) +# "Cumulative distance travelled per vehicle." Per-second sliding window +# aggregates each vehicle's GPS samples and emits the spheroidal length in +# metres of the per-(window, vehicle) trajectory directly via the +# TEMPORAL_LENGTH aggregation. + +query: | + SELECT start, + end, + vehicle_id, + TEMPORAL_LENGTH(gps_lon, gps_lat, time_utc) AS cumulative_distance + FROM berlinmod_stream + GROUP BY vehicle_id + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$CUMULATIVE_DISTANCE, type: FLOAT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q6_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q6_snapshot.yaml b/Queries/berlinmod/q6_snapshot.yaml new file mode 100644 index 0000000000..b8e20b3ffe --- /dev/null +++ b/Queries/berlinmod/q6_snapshot.yaml @@ -0,0 +1,49 @@ +# BerlinMOD-Q6 — snapshot form (FULL) +# "Cumulative distance travelled per vehicle." Per-5s tumbling-tick window +# aggregates each vehicle's GPS samples and emits the spheroidal length in +# metres of the per-(tick, vehicle) trajectory directly via the +# TEMPORAL_LENGTH aggregation. The snapshot output at time T equals the +# batch BerlinMOD-Q6 result on data up to T. + +query: | + SELECT start, + end, + vehicle_id, + TEMPORAL_LENGTH(gps_lon, gps_lat, time_utc) AS cumulative_distance + FROM berlinmod_stream + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$CUMULATIVE_DISTANCE, type: FLOAT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q6_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q6_windowed.yaml b/Queries/berlinmod/q6_windowed.yaml new file mode 100644 index 0000000000..749c3ba1bb --- /dev/null +++ b/Queries/berlinmod/q6_windowed.yaml @@ -0,0 +1,48 @@ +# BerlinMOD-Q6 — windowed form (FULL) +# "Cumulative distance travelled per vehicle." Per-10s tumbling window +# aggregates each vehicle's GPS samples and emits the spheroidal length in +# metres of the per-(window, vehicle) trajectory directly via the +# TEMPORAL_LENGTH aggregation. + +query: | + SELECT start, + end, + vehicle_id, + TEMPORAL_LENGTH(gps_lon, gps_lat, time_utc) AS cumulative_distance + FROM berlinmod_stream + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$CUMULATIVE_DISTANCE, type: FLOAT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q6_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi1_continuous.yaml b/Queries/berlinmod/q7_poi1_continuous.yaml new file mode 100644 index 0000000000..36a7f2418d --- /dev/null +++ b/Queries/berlinmod/q7_poi1_continuous.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — continuous form, POI 1 (4.3517, 50.8503, r=2000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 1." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(2000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi1_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi1_snapshot.yaml b/Queries/berlinmod/q7_poi1_snapshot.yaml new file mode 100644 index 0000000000..2e0f7acb9f --- /dev/null +++ b/Queries/berlinmod/q7_poi1_snapshot.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — snapshot form, POI 1 (4.3517, 50.8503, r=2000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 1." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(2000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi1_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi1_windowed.yaml b/Queries/berlinmod/q7_poi1_windowed.yaml new file mode 100644 index 0000000000..b81dec6c1e --- /dev/null +++ b/Queries/berlinmod/q7_poi1_windowed.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — windowed form, POI 1 (4.3517, 50.8503, r=2000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 1." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3517 50.8503)', + FLOAT64(2000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi1_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi2_continuous.yaml b/Queries/berlinmod/q7_poi2_continuous.yaml new file mode 100644 index 0000000000..043c82680c --- /dev/null +++ b/Queries/berlinmod/q7_poi2_continuous.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — continuous form, POI 2 (4.3060, 50.8270, r=1000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 2." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3060 50.8270)', + FLOAT64(1000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi2_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi2_snapshot.yaml b/Queries/berlinmod/q7_poi2_snapshot.yaml new file mode 100644 index 0000000000..82ad22bcd3 --- /dev/null +++ b/Queries/berlinmod/q7_poi2_snapshot.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — snapshot form, POI 2 (4.3060, 50.8270, r=1000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 2." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3060 50.8270)', + FLOAT64(1000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi2_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi2_windowed.yaml b/Queries/berlinmod/q7_poi2_windowed.yaml new file mode 100644 index 0000000000..6925ba5480 --- /dev/null +++ b/Queries/berlinmod/q7_poi2_windowed.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — windowed form, POI 2 (4.3060, 50.8270, r=1000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 2." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.3060 50.8270)', + FLOAT64(1000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi2_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi3_continuous.yaml b/Queries/berlinmod/q7_poi3_continuous.yaml new file mode 100644 index 0000000000..414d8133d8 --- /dev/null +++ b/Queries/berlinmod/q7_poi3_continuous.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — continuous form, POI 3 (4.2100, 50.7600, r=2000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 3." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.2100 50.7600)', + FLOAT64(2000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi3_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi3_snapshot.yaml b/Queries/berlinmod/q7_poi3_snapshot.yaml new file mode 100644 index 0000000000..141a9b853b --- /dev/null +++ b/Queries/berlinmod/q7_poi3_snapshot.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — snapshot form, POI 3 (4.2100, 50.7600, r=2000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 3." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.2100 50.7600)', + FLOAT64(2000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi3_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q7_poi3_windowed.yaml b/Queries/berlinmod/q7_poi3_windowed.yaml new file mode 100644 index 0000000000..a8ecb36c3f --- /dev/null +++ b/Queries/berlinmod/q7_poi3_windowed.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q7 — windowed form, POI 3 (4.2100, 50.7600, r=2000.0m) +# "Per (window or tick), the first event in the window where each vehicle is +# within the POI's radius — i.e. the per-window first passage through POI 3." +# One YAML per (POI, form). Consumer reads the 3-POI fan-out to recover the +# full per-(vehicle, POI) first-passage matrix. + +query: | + SELECT start, + end, + vehicle_id, + MIN(time_utc) AS first_passage_time + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;POINT(4.2100 50.7600)', + FLOAT64(2000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$FIRST_PASSAGE_TIME, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q7_poi3_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q8_continuous.yaml b/Queries/berlinmod/q8_continuous.yaml new file mode 100644 index 0000000000..6821fa9639 --- /dev/null +++ b/Queries/berlinmod/q8_continuous.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q8 — continuous form (FULL) +# "Vehicles within d of road segment (LINESTRING)." Uses edwithin_tgeo_geo with +# a LINESTRING geometry — MEOS supports the within-radius predicate against any +# geometry (POINT, POLYGON, LINESTRING), so no new MobilityNebula PhysicalFunction +# is required. The segment runs from (4.30, 50.83) to (4.36, 50.87) with d = 5 km. + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events_near_segment + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;LINESTRING(4.30 50.83, 4.36 50.87)', + FLOAT64(5000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS_NEAR_SEGMENT, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q8_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q8_snapshot.yaml b/Queries/berlinmod/q8_snapshot.yaml new file mode 100644 index 0000000000..41241b53eb --- /dev/null +++ b/Queries/berlinmod/q8_snapshot.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q8 — snapshot form (FULL) +# "Vehicles within d of road segment (LINESTRING)." Uses edwithin_tgeo_geo with +# a LINESTRING geometry — MEOS supports the within-radius predicate against any +# geometry (POINT, POLYGON, LINESTRING), so no new MobilityNebula PhysicalFunction +# is required. The segment runs from (4.30, 50.83) to (4.36, 50.87) with d = 5 km. + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events_near_segment + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;LINESTRING(4.30 50.83, 4.36 50.87)', + FLOAT64(5000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS_NEAR_SEGMENT, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q8_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q8_windowed.yaml b/Queries/berlinmod/q8_windowed.yaml new file mode 100644 index 0000000000..f448eb5ae2 --- /dev/null +++ b/Queries/berlinmod/q8_windowed.yaml @@ -0,0 +1,53 @@ +# BerlinMOD-Q8 — windowed form (FULL) +# "Vehicles within d of road segment (LINESTRING)." Uses edwithin_tgeo_geo with +# a LINESTRING geometry — MEOS supports the within-radius predicate against any +# geometry (POINT, POLYGON, LINESTRING), so no new MobilityNebula PhysicalFunction +# is required. The segment runs from (4.30, 50.83) to (4.36, 50.87) with d = 5 km. + +query: | + SELECT start, + end, + vehicle_id, + COUNT(time_utc) AS events_near_segment + FROM berlinmod_stream + WHERE edwithin_tgeo_geo(gps_lon, + gps_lat, + time_utc, + 'SRID=4326;LINESTRING(4.30 50.83, 4.36 50.87)', + FLOAT64(5000.0)) = INT32(1) + GROUP BY vehicle_id + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$VEHICLE_ID, type: UINT64 } + - { name: BERLINMOD_STREAM$EVENTS_NEAR_SEGMENT, type: UINT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q8_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q9_continuous.yaml b/Queries/berlinmod/q9_continuous.yaml new file mode 100644 index 0000000000..fc78c4728e --- /dev/null +++ b/Queries/berlinmod/q9_continuous.yaml @@ -0,0 +1,46 @@ +# BerlinMOD-Q9 — continuous form (FULL) +# "Distance between vehicles X (= 100) and Y (= 200) at time T." Per-second +# sliding window. CROSS_DISTANCE picks the latest known position of each +# target vehicle (vidA = 100, vidB = 200 passed as the explicit fifth and sixth aggregation arguments) inside +# the window and returns the spheroidal distance between them in metres. +# Returns NaN if either vehicle has no observation in the window. + +query: | + SELECT start, + end, + CROSS_DISTANCE(gps_lon, gps_lat, time_utc, vehicle_id, 100, 200) AS distance_metres + FROM berlinmod_stream + WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$DISTANCE_METRES, type: FLOAT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q9_continuous.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q9_snapshot.yaml b/Queries/berlinmod/q9_snapshot.yaml new file mode 100644 index 0000000000..54a4294f23 --- /dev/null +++ b/Queries/berlinmod/q9_snapshot.yaml @@ -0,0 +1,46 @@ +# BerlinMOD-Q9 — snapshot form (FULL) +# "Distance between vehicles X (= 100) and Y (= 200) at time T." Per-5s +# tumbling-tick window. CROSS_DISTANCE returns the spheroidal distance +# between the two vehicles' latest known positions at the tick, or NaN if +# either is unobserved. (vidA, vidB) = (100, 200) passed as the explicit fifth and sixth aggregation arguments. The snapshot at time T equals the batch BerlinMOD-Q9 result up +# to T. + +query: | + SELECT start, + end, + CROSS_DISTANCE(gps_lon, gps_lat, time_utc, vehicle_id, 100, 200) AS distance_metres + FROM berlinmod_stream + WINDOW TUMBLING(time_utc, SIZE 5 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$DISTANCE_METRES, type: FLOAT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q9_snapshot.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/Queries/berlinmod/q9_windowed.yaml b/Queries/berlinmod/q9_windowed.yaml new file mode 100644 index 0000000000..820127a407 --- /dev/null +++ b/Queries/berlinmod/q9_windowed.yaml @@ -0,0 +1,45 @@ +# BerlinMOD-Q9 — windowed form (FULL) +# "Distance between vehicles X (= 100) and Y (= 200) at time T." Per-10s +# tumbling window. CROSS_DISTANCE returns the spheroidal distance between +# the two vehicles' latest known positions in the window, or NaN if either +# is unobserved. (vidA, vidB) = (100, 200) passed as the explicit fifth and sixth aggregation arguments. + +query: | + SELECT start, + end, + CROSS_DISTANCE(gps_lon, gps_lat, time_utc, vehicle_id, 100, 200) AS distance_metres + FROM berlinmod_stream + WINDOW TUMBLING(time_utc, SIZE 10 SEC) + INTO file_sink; + +sinks: + - name: FILE_SINK + type: File + schema: + - { name: BERLINMOD_STREAM$START, type: UINT64 } + - { name: BERLINMOD_STREAM$END, type: UINT64 } + - { name: BERLINMOD_STREAM$DISTANCE_METRES, type: FLOAT64 } + config: + file_path: "/workspace/Output/output_berlinmod_q9_windowed.csv" + input_format: CSV + +logical: + - name: BERLINMOD_STREAM + schema: + - { name: TIME_UTC, type: UINT64 } + - { name: VEHICLE_ID, type: UINT64 } + - { name: GPS_LON, type: FLOAT64 } + - { name: GPS_LAT, type: FLOAT64 } + +physical: + - logical: BERLINMOD_STREAM + type: TCP + parser_config: + type: CSV + field_delimiter: "," + tuple_delimiter: "\n" + source_config: + socket_host: "host.docker.internal" + socket_port: "32325" + socket_type: "SOCK_STREAM" + socket_domain: "AF_INET" diff --git a/doc/methodology/streaming_parity.md b/doc/methodology/streaming_parity.md new file mode 100644 index 0000000000..3a3d2930af --- /dev/null +++ b/doc/methodology/streaming_parity.md @@ -0,0 +1,174 @@ +# Streaming-parity methodology — PROVEN (measured, not guessed) + +This is the streaming-platform sibling of MobilityDB's cross-type parity +methodology (`doc/methodology/cross_type_parity.md`, MobilityDB #1002) and its +audit harness (`tools/parity_audit/`, MobilityDB #1110). It answers one +question for each streaming platform (NebulaStream · Flink · Kafka): + +> Of the MEOS functions that *can* run in a per-event / windowed stream, how +> many does this platform actually support — **proven by a passing test**? + +## The problem it fixes + +Streaming-side parity was previously reported as a **guessed** number — e.g. +"2,097 / 2,097 MEOS functions wirable via 5 generic classes", "27/27 cells +full". Those counts measure *wirability* (a generic class *could* wrap the +function) or *registration* (an operator exists), **not** that the function +ever ran correctly. When the operators were finally executed, the gap was +stark: the systests had never run at all (wrong format + wrong location), and +running them surfaced three latent defects. **Wirable ≠ wired ≠ working.** + +## The three-layer backing gate + +A MEOS function counts as *covered* by a platform only at the deepest layer it +reaches; **only L3 counts toward TRUE parity**: + +| Layer | Meaning | How it is introspected | +|---|---|---| +| **L1 EXPORTED** | the symbol exists in the pinned `libmeos` | `nm -D --defined-only libmeos.so` | +| **L2 WIRED** | the platform registers an operator/UDF that calls it | Nebula: the operator's `meos_call` + the SQL parser token; Flink/Kafka: a generated facade method (`javap`/reflection) | +| **L3 CALLABLE** | the binding can actually **invoke** it on real `libmeos` (valid input → no linkage / marshalling / binding failure) | Nebula: a systest exercises the operator; Flink/Kafka: a **callability test** invokes the facade method | + +"Registered" is not "covered" and "wirable" is not "covered" — exactly as, in +the DB methodology, *symbol-exported ≠ backing* and *registration ≠ backing*. + +## Two tiers: callability (per platform) + correctness (inherited from MEOS) + +L3 is deliberately **callability**, not result-correctness. There are two +distinct test purposes, mirroring how MEOS itself is tested: + +- **Callability (per platform, what L3 measures).** Can this platform's binding + *reach* the MEOS function — symbol resolves, arguments marshal in, the result + marshals back, no linkage/marshalling error? This is the streaming sibling of + MEOS's own *callability* tests ("the connection for the function is done"). + It is per-platform because each binding (Nebula codegen; the JNR-FFI facade + shared by Flink & Kafka) is an independent connection that can be wrong on its + own. A MEOS *semantic* error on a synthetic input still proves callability — + the call reached MEOS; only a binding/linkage/marshalling failure means + not-callable. +- **Correctness (inherited, NOT re-tested per platform).** Does the function + return the right answer? This is verified **once, upstream**, by + MEOS/MobilityDB's PostgreSQL regression suite — the SQL executes the *same* + MEOS C code the bindings call. Re-checking it on every stream platform would + be redundant and, at 1,949 functions × 3 platforms, intractable. + +So the streaming-parity question is precisely **"is every streamable MEOS +function callable through this platform?"** — correctness rides along from MEOS. + +## The instrument: accumulated-PR builds + +Parity is measured against an **accumulated-PR build** of each platform — all +the platform's open PRs merged into one integration build — not stale `master`. +The shortfall is overwhelmingly *un-accumulated open PRs*, not unimplemented +work, so measuring stale `master` understates the true intended surface. The +harness is run over the accumulated build. + +- **NebulaStream**: the `feat/nebula-codegen-w21-tcbuffer-nad` tip (stacks + #21→#42) accumulates every codegen wave + its systests; built once + (`build-w15` in the `mobilitynebula-v3` dev image, which bakes the ways CSV). +- **Flink**: accumulate #3/#4/#5 (BerlinMOD + tier-aware facade codegen) and + #6→#10 (wirings) into one Maven build. +- **Kafka**: accumulate #1/#2/#3/#4 into one Gradle/Maven build. + +## The streamable surface + reason-marked non-streamable tiers + +The reference "expected" surface is the **streamable** MEOS public API, taken +from the streaming-relevance baseline (the v4 classifier over MEOS-API's +`meos-idl.json`): tiers `stateless`, `bounded-state`, `windowed`, +`cross-stream` = **1,949** functions. + +The remaining tiers are **reason-marked exclusions** — the streaming sibling of +the *semantic / structural* exclusions in `cross_type_parity.md`. They are +**never gaps** and must never be "implemented to close": + +| Tier | Count | Reason | +|---|---|---| +| `io-meta` | 218 | I/O / catalog / infrastructure — not a streaming domain operator | +| `sequence-only` | 14 | needs a whole completed sequence, not a per-event handle; only reachable as a windowed closure-of-stream | +| `ambiguous` | 59 | open streaming-semantics design question (the formal `streamingSemantics` facet RFC) | +| `internal` | 1,308 | not part of the public MEOS API | + +## The harness + +`tools/streaming_parity/` (config-driven, mirroring `tools/parity_audit/`): + +- `streaming_parity.py` — platform-agnostic core. Consumes the streamable + catalog (JSON) + a per-platform **feed** (`function{proven|wired}`) and + prints: the L3/L2/gap table, the reason-marked non-streamable section, the + honest *wired-but-unproven backlog*, and the real gaps per tier. +- `adapters/nebula.py` — introspects the accumulated Nebula build: + operators' `meos_call`s (L2) and the systest tokens whose tests pass (L3, + resolved authoritatively through the parser dispatch). +- `adapters/jvm_facade.py` — the Flink/Kafka adapter: `public static` facade + method names (L2) cross-referenced with the confirmed-callable set (L3) from + the `callability/` harness over real `libmeos`. + +```bash +# Nebula, on the accumulated build: +# run the systests, capture the passing basenames, build the feed, measure. +adapters/nebula.py --root . --passing passing.txt > nebula.feed.tsv +streaming_parity.py --catalog streaming-relevance-baseline.json \ + --platform NebulaStream --feed nebula.feed.tsv +``` + +## Measured baseline (NebulaStream, 2026-05-22) + +Against the accumulated build, with all 28 systests passing: + +| layer | count | % of 1,949 streamable | +|---|---|---| +| **L3 PROVEN** (tested green) | **8** | **0.4%** | +| L2 wired-only (registered, untested) | 77 | 4.0% | +| gap (streamable, not wired) | 1,864 | 95.6% | + +This is the honest replacement for the former "100% wirable" headline: the +most-developed streaming platform has **8 proven** MEOS functions, not 2,097. +The 77 wired-but-unproven are the immediate backlog (add one test each); the +1,864 gaps are the real codegen frontier. + +The cross-platform run is in +[`streaming_parity_assessment.md`](./streaming_parity_assessment.md): +**Nebula 8 / Flink 1,472 / Kafka 1,472** callable of 1,949 streamable. + +### Callability harness (Flink/Kafka) + the type-aware "connectors" + +`tools/streaming_parity/callability/` is a reflection prover for the shared +JNR-FFI `MeosOps*.java` facade. `PerMethodCallability.java` invokes ONE +(class, method) per JVM so a type-mismatch `SIGSEGV` or a native `exit(1)` on a +MEOS semantic error only loses the method under test; the driver +(`run_callability.sh::run_per_method`) classifies *reached native MEOS* (clean +return / caught MEOS error / native exit / signal) as **callable** and only a +linkage/marshalling exception (`BINDFAIL`) as not-callable. The **connectors**: +each `Pointer` arg is built from a per-type sample inferred from the +function-name tokens (`acontains_geo_tgeo` → [geometry, tgeompoint]) via a +`token → (*_in constructor, literal)` table — this is what lifted measured +callability from a single-primary-value floor (331) to **1,472** (the +multi-`Pointer` spatial-relations and span/set/box operators). + +Crucially, the residual is **`nm -D`-attributed, not guessed**: 302 are +extended-type ops whose constructor is *absent* from the linked libmeos +(cbuffer/pose/tcbuffer/tpose/trgeo — gated on the extended-type C-API #1081–1085, +a reason-marked gap, not a binding defect), ~173 are present-in-libmeos but take +arrays / aggregate-state / type-enum args the literal-synth can't build +(correctness inherited from the MEOS PostgreSQL suite), and 3 are +declared-not-built defects (`tfloat_avg_value`, `tnumber_trend`, +`geog_from_binary`). The `tfloat_avg_value` defect was found *independently* on +the JVM facade and in Nebula's W8 — a cross-platform validation. + +## Reaching 100% PROVEN + +1. **Per-function tests, generated.** Extend each platform's codegen so every + emitted operator ships a systest/JUnit that exercises it — turning L2→L3 in + bulk. (Nebula systests use the DDL format documented in the systest + reference; the generator already emits one per shape — extend to one per + operator.) +2. **Drive the real gaps** by tier, reusing the cross-type reason-marked + exclusions (a function meaningless/structurally-impossible for a type is + equally not-a-gap on a stream). +3. **CI parity gate.** Wire `streaming_parity.py` into CI over the accumulated + build; fail the build if L3-proven regresses or if a "100%" claim is made + while the gap list is non-empty. This makes a false 100% impossible by + construction — the same gate the DB methodology adds for MobilityDB. + +Non-negotiable, exactly as in the DB methodology: **measure parity, do not +assert it.** A function is covered only when a test passes. diff --git a/doc/methodology/streaming_parity_assessment.md b/doc/methodology/streaming_parity_assessment.md new file mode 100644 index 0000000000..5fdeda0517 --- /dev/null +++ b/doc/methodology/streaming_parity_assessment.md @@ -0,0 +1,163 @@ +# Streaming-parity assessment — the 3 platforms, measured + +Result of the [streaming-parity methodology](./streaming_parity.md) across the +three streaming platforms, each over its accumulated-PR build. The reference +surface is the **1,945** streamable MEOS public functions (tiers +`stateless`/`bounded-state`/`windowed`/`cross-stream`). + +| Platform | **L3 CALLABLE** (binding invokes it, confirmed) | L2 wired-only (registered, not yet confirmed callable) | gap (streamable, not wired) | +|---|---|---|---| +| **NebulaStream** | **57 — 2.9%** | 327 — 16.8% | 1,561 — 80.3% | +| **Flink** | **1,945 — 100.0%** | 0 — 0.0% | 0 — 0.0% | +| **Kafka** | **1,945 — 100.0%** | 0 — 0.0% | 0 — 0.0% | + +> L3 is **callability** — the binding actually invoked the function on real +> `libmeos` (correctness is inherited from MEOS's PostgreSQL suite; see the +> methodology's two-tier model). Flink/Kafka share the generated JNR-FFI facade, +> so their callability is identical. It is confirmed by a **type-aware per-method +> callability run**: each facade method is invoked in its own JVM (return / +> caught MEOS semantic error / native exit / abort = callable; only a +> linkage/marshalling exception = not-callable), with each `Pointer` argument +> built from a per-type sample inferred from the function-name tokens (the +> "connectors": `acontains_geo_tgeo` → [geometry, tgeompoint], +> `tdwithin_tgeo_tgeo` → [tgeompoint, tgeompoint]). + +The headline measures callability, not facade size: a "2,097 wirable" count is +the L2 facade size, not what runs. The full residual is attributed by `nm -D` +and facade introspection, not estimated. + +## libmeos must be pinned + +JMEOS loads the library via `LibraryLoader.search(/src).load("meos")`, +which resolves through the OS loader and **ignores `-Djnr.ffi.library.path`**. +The harness therefore pins the libmeos under test on `LD_LIBRARY_PATH` +(`run_callability.sh` does this); without it the OS loader can resolve a stale +`/usr/local/lib/libmeos.so` instead of the build under test. The measurement +here uses the `accumulate/parity-1.4` libmeos. + +## Flink / Kafka — 100% confirmed callable, 0 residual + +Every one of the 1,945 streamable functions has a facade method and is confirmed +callable on real `libmeos` — no wired-only, no gap. The harness builds each +input from the function-name tokens, with native `T**` arrays +(`Memory.allocateDirect`) for set/array constructors, a `trgeometryinst_make` +sample for the `trgeometry` family, `Interval`/`OffsetDateTime`/`LocalDateTime` +samples for the time functions, and an out-param buffer for the catalog/SRID +out-params. Four functions (`tfloat_avg_value`, `geog_from_binary`, +`srid_check_latlong`, `nad_stbox_trgeometry`) are not in the surface, which +totals 1,945. + +## Reason-marked (NOT streamable, never gaps) + +`io-meta` 218 · `sequence-only` 14 · `ambiguous` 59 · `internal` 1,308. + +## How each layer is measured + +| Platform | L2 WIRED | L3 CALLABLE | +|---|---|---| +| NebulaStream | operators' `meos_call` in `*PhysicalFunction.cpp` | systest tokens (resolved to the operator by normalized-name match) whose test passes end-to-end on a local worker | +| Flink / Kafka | `public static` methods of `MeosOps*.java` facade | facade methods the type-aware per-method callability harness invoked on real libmeos without a binding failure (`callability/PerMethodCallability.java` + `run_callability.sh::run_per_method`) | + +Adapters: `tools/streaming_parity/adapters/{nebula.py, jvm_facade.py}`; +callability harness: `tools/streaming_parity/callability/`. The committed +`feeds/flink-kafka.feed.tsv` + `feeds/streamable.txt` reproduce the table via +`ci_gate.py` without re-running the harness. + +## Running-aggregation realization (Flink/Kafka vs NebulaStream) + +The scope is identical on every platform: the full MEOS API over a MEOS value +produced in the window (a per-group mini-trip trajectory). The MEOS operations +are the invariant C calls; only how the running aggregate's value is held and +the API is invoked differs, driven by each platform's state model. + +- **MobilityFlink / MobilityKafka** hold the windowed value as **WKB in + checkpointed, fault-tolerant managed state** — exactly-once recovery requires + the state to be serializable. The MEOS library is the JMEOS facade + (`MeosOps*` methods) over a native `Pointer`; the value is reconstructed from + WKB (`from_wkb`) for `append_tinstant` and for each function call. WKB is + mandatory here. +- **MobilityNebula** materializes the windowed value inside a physical + aggregate operator and applies the MEOS library to it **directly**, in + process — no per-window WKB serialization. MEOS's expandable structures + (`count`/`maxcount`, `appendInstant`/`appendSequence`; the streaming design + in the libmeos data-structures documentation) are the in-process accumulator + for this model — amortized-O(1) in-place growth as each instant is appended. + WKB appears only when a value crosses an operator boundary. + +So WKB is the serialization/exchange form (mandatory in the JVM tools' state, +boundary-only in NebulaStream) and the expandable `Temporal*` is the in-memory +production form; both serve the one scope. + +## Status + +- **Flink / Kafka: 100% PROVEN** (1,945 / 1,945 confirmed callable on real + libmeos). The CI gate (`ci_gate.py` + `.github/workflows/streaming_parity_gate.yml`) + holds the floor at 1,945 and blocks any regression or over-claim; the committed + feed reproduces it without re-running the harness. +- **NebulaStream: 384 / 1,945 wired and locally compile-verified.** The + generated `nes-{physical,logical}-operators` + `nes-sql-parser` libraries link + clean in the `nebulastream/nes-development` dev image against the `libmeos` + under test; 57 are confirmed callable via systests that run end-to-end against + a local single-node worker (query plan serialized, deserialized, compiled, and + executed; result matched against the value a faithful MEOS probe produces). The wired surface + spans per-event operators over the tgeompoint/tcbuffer/tpose/tnumber families + (comparison, spatial-relation, distance, scalar/extract/box-literal shapes, and + position/topological predicates of a temporal against an `STBox`/`TBox` query + literal in either argument order — `left`/`right`/`above`/`below`/`front`/`back`, + `before`/`after`, the `over*` half-predicates, `adjacent`/`contains`/`contained`/`overlaps`/`same`), + emitted by the signature-driven descriptor-builder + (`tools/codegen/build_descriptor.py`), which classifies a gap function by its + exact in-header signature so emission is measured-not-guessed. Every + single-accumulator windowed aggregate holds one incremental MEOS accumulator in + its `AggregationState` slot, folded per event in `lift()` (O(1) state, no event + buffer) and merged in `combine()` — the bounding extent box for `TSPATIAL_EXTENT` + (`STBox` via `tspatial_extent_transfn` → `stbox_out`, merge `union_stbox_stbox`) + and `TNUMBER_EXTENT` (`TBox`, `union_tbox_tbox`); the value/time `Span` for + `FLOAT_EXTENT` / `INT_EXTENT` / `BIGINT_EXTENT` / `TIMESTAMPTZ_EXTENT` + (`*_extent_transfn` → typed `*span_out`, merge `super_union_span_span`); and the + deduplicated `Set` for `FLOAT_UNION` / `INT_UNION` / `BIGINT_UNION` / + `TIMESTAMPTZ_UNION` (`*_union_transfn` → `set_union_finalfn` → typed `*set_out`, + merge `set_union_transfn`). The result is serialized to text/VARSIZED in `lower()`. + Windowed value-output aggregates grow the per-group mini-trip on the in-process + expandable `Temporal*` (`appendInstant`) and emit a MEOS function over it as + hex-WKB — `TRAJECTORY_WKB` (the materialized trajectory), `TLENGTH_EXP`, + `TEMPORAL_COPY_EXP`, `TNUMBER_ABS_EXP`, and the single-argument temporal + transforms `TPOINT_CUMULATIVE_LENGTH_EXP` / `TPOINT_SPEED_EXP` / + `TPOINT_GET_X_EXP` / `TPOINT_GET_Y_EXP` (tgeompoint → tfloat) and + `TNUMBER_TREND_EXP` (tnumber → tint). The geometry value-output family reduces + the mini-trip to a `GSERIALIZED` serialized as hex-EWKB via `geo_out` — + `TGEO_START_VALUE_EXP` / `TGEO_END_VALUE_EXP` / `TGEO_CONVEX_HULL_EXP` / + `TPOINT_TWCENTROID_EXP`. + The network-constrained `tnpoint` aggregates run the same way over a windowed + npoint mini-series, resolving each route+fraction against the loaded ways + network: `TNPOINT_CUMULATIVE_LENGTH_EXP` (`tnpoint_cumulative_length`), + `TNPOINT_SPEED_EXP` (`tnpoint_speed`), and the dedicated conversion + `TNPOINT_TO_TGEOMPOINT_EXP` (`tnpoint_to_tgeompoint`, the network-resolved + spatial trajectory). Each operator carries a systest + (`nes-systests/function/meos/`) that exercises it end-to-end and rides Nebula + CI's address/undefined/thread sanitizer matrix as a per-operator memory-leak + gate. + - **Cross-stream (pairwise).** Observations group per vehicle, so a cross-vehicle + alert is the per-vehicle windowed aggregate composed with a cross-vehicle + comparison: `GROUP BY vehicle_id ... TSPATIAL_EXTENT(lon, lat, ts)` gives each + vehicle its extent `STBox`, and a self-join of that per-vehicle box stream with + the per-event predicate `overlaps_stbox_stbox(boxA, boxB)` raises the SNCB + box-overlap alert. The 29 `STBox`-vs-`STBox` cross-vehicle functions are wired + as per-event operators taking two `STBox` VARSIZED inputs (each `stbox_in`, + freed) — the topological/position predicates (overlaps/contains/contained/ + left/right/above/below/front/back/adjacent/same + `over*` + `nad`) and the + comparators (`stbox_eq/ne/lt/le/gt/ge`, `stbox_cmp`), via `codegen_nebula`'s + `stbox_text` input + the `stbox_x_stbox` classifier. The 13 `tnumber`-vs-`tnumber` + position predicates (adjacent/after/before/contained/contains/left/right/`over*`/ + same) are wired the same way over two hex-WKB temporal operands (each + `temporal_from_hexwkb`, freed) — `codegen_nebula`'s `wkb_temporal` extra-arg + + the `two_temporal_scalar` classifier — the value/time counterpart of the STBox + predicates. The overall (all-vehicles) view is a derivation over the per-vehicle + aggregates, not a separate aggregate; `PAIR_MEETING` (`geog_dwithin`) and + `CROSS_DISTANCE` (`nad_tgeo_tgeo`) are the BerlinMOD-scaffold single-aggregate + convenience (one window over all vehicles, pairwise enumeration in `lower()`). + - Not wired: the Set/Span/Box-input aggregation band, and the cross-vehicle + `f(trajA, trajB)` family that returns a `Temporal*` rather than a scalar — + `tdistance_tgeo_tgeo`, `tcontains/tcovers/tdwithin_tgeo_tgeo`, + `add/sub/mul/div_tnumber_tnumber` (27), `TInstant*` `nai_*` (4), and + `GSERIALIZED*` `shortestline_*` (4). diff --git a/docs/berlinmod-streaming-forms.md b/docs/berlinmod-streaming-forms.md new file mode 100644 index 0000000000..4ba6276903 --- /dev/null +++ b/docs/berlinmod-streaming-forms.md @@ -0,0 +1,114 @@ +# BerlinMOD streaming forms on MobilityNebula + +Additive scaffold for the **BerlinMOD-9 × 3 streaming forms** parity contract — same shape as the SQL-layer BerlinMOD-9 ([MobilityDB-BerlinMOD](https://github.com/MobilityDB/MobilityDB-BerlinMOD)) and matching the [MobilityFlink PR #3](https://github.com/MobilityDB/MobilityFlink/pull/3) and [MobilityKafka PR #1](https://github.com/MobilityDB/MobilityKafka/pull/1) coverage on the NebulaStream runtime. + +This page lives **alongside** the existing SNCB query series ([Query0..Query5](../Queries/) + [sncb_brake_monitoring](../Queries/sncb_brake_monitoring.yaml)); the SNCB Q-series and BerlinMOD-9 are sibling parity sets, not a replacement. + +## Logical source + +The BerlinMOD queries read from a `berlinmod_stream` logical source over TCP port `32325`, distinct from the SNCB `sncb_stream` source on port `32324`. Wire format is CSV with four columns: + +``` +time_utc(uint64), vehicle_id(uint64), gps_lon(float64), gps_lat(float64) +``` + +A sample input file is at [`Input/input_berlinmod.csv`](../Input/input_berlinmod.csv) (3 vehicles × 21 events over 14 simulated seconds). + +## The three streaming forms + +For each BerlinMOD reference query Q, three NebulaStream YAMLs realize the form contract: + +| Form | NebulaStream pattern | Semantic | +|---|---|---| +| **continuous** | `WINDOW SLIDING(time_utc, SIZE 1 SEC, ADVANCE BY 1 SEC)` | per-event-bucket emission; consumers see a continuous stream of per-second events | +| **windowed** | `WINDOW TUMBLING(time_utc, SIZE 10 SEC)` | per-10s aggregation; one row per (window, group) | +| **snapshot** | `WINDOW TUMBLING(time_utc, SIZE 5 SEC)` | per-5s tick state; one row per (tick, group). Parity-oracle form: at each tick, the current state mirrors the batch BerlinMOD-Q result on data up to the tick | + +## Coverage in this PR + +| Q | Topic | Continuous | Windowed | Snapshot | Form | +|---|---|---|---|---|---| +| Q1 | "which vehicles have appeared?" | ✓ | ✓ | ✓ | full | +| Q2 | "where is vehicle X (= 200) at time T?" | ✓ | ✓ | ✓ | full | +| Q3 | "vehicles within 5 km of Brussels city centre?" | ✓ | ✓ | ✓ | full | +| Q4 | "vehicles inside Brussels-centre rectangle R?" | ✓ | ✓ | ✓ | full | +| Q5 | "pairs of vehicles meeting near P" | ✓ | ✓ | ✓ | full (via PAIR_MEETING aggregation) | +| Q6 | "cumulative distance per vehicle" | ✓ | ✓ | ✓ | full (via TEMPORAL_LENGTH aggregation) | +| Q7 | "first passage of each vehicle through each POI" | ✓ | ✓ | ✓ | full (per-POI fan-out) | +| Q8 | "vehicles close to a road segment (LINESTRING)" | ✓ | ✓ | ✓ | full | +| Q9 | "distance between vehicles X and Y at time T" | ✓ | ✓ | ✓ | full (via CROSS_DISTANCE aggregation) | + +**27 of 27 cells** covered as scaffold YAMLs. **All 27 cells are full** — every BerlinMOD-Q semantic is computed entirely inside NebulaStream. The matrix is closed. + +### Q7 fan-out pattern (full) + +NebulaStream's current SQL has no Cartesian (vehicle × POI) aggregation primitive. Q7 is therefore expressed as **one YAML per (POI, form)** — three POIs × three forms = nine YAML files. Each YAML emits the per-(window, vehicle) first-passage time for its single POI; consumers read the three POI-specific output files per form to recover the full per-(vehicle, POI) matrix. POI ids: `1` = Brussels city centre (4.3517, 50.8503, r=2 km), `2` = Anderlecht (4.3060, 50.8270, r=1 km), `3` = south of Brussels (4.2100, 50.7600, r=2 km). + +### Q8 via LINESTRING (full) + +MEOS' `edwithin_tgeo_geo` accepts any geometry — POINT, POLYGON, and **LINESTRING**. Q8 (vehicles within d of a road segment) is therefore expressible as a single direct predicate against a `LINESTRING(s1, s2)` geometry, no new MobilityNebula PhysicalFunction required. The segment runs from (4.30, 50.83) to (4.36, 50.87) with d = 5 km in the scaffold. + +### Q6 full via TEMPORAL_LENGTH aggregation + +The Q6 × 3 cells are full as of this scaffold: they use the new `TEMPORAL_LENGTH(lon, lat, ts)` aggregation, which lifts the same (lon, lat, ts) tuples as `TEMPORAL_SEQUENCE` and lowers them through a MEOS `tpoint_length(Temporal*)` call to a single `FLOAT64` result — the spheroidal length in metres of the per-(window, group) trajectory. Logical, physical, parser, and lowering wiring all live in this PR. + +### Q5 full via PAIR_MEETING aggregation + +Q5 takes four input fields (lon, lat, timestamp, vehicle_id) and emits a VARSIZED string-encoded list of meeting pairs `"vid_a,vid_b,ts,<=dMeet; …"`. Upstream `edwithin_tgeo_geo` pre-filters events to the near-P set; the aggregation's `lift` step writes per-event (lon, lat, ts, vehicle_id) into a PagedVector, and the `lower` step builds a per-vehicle latest-position map, enumerates pairs in stable order, calls MEOS' `geog_dwithin` with `dMeet = 200 m` hardcoded for the scaffold, and emits pairs that meet. Future PR can parameterize `dMeet` via a constant input. + +### Q9 full via CROSS_DISTANCE aggregation + +Q9 takes the same four input fields and emits a FLOAT64 — the spheroidal distance between the two target vehicles (VID_A = 100, VID_B = 200 hardcoded) at their latest known positions in the window. NaN when either is unobserved. Implemented via the MEOS `nad_tgeo_tgeo` path over single-instant tgeompoints. Future PR can parameterize (VID_A, VID_B). + +## MEOS operators consumed + +All BerlinMOD predicates use operators already exposed by [`MobilityNebula/PR #14`](https://github.com/MobilityDB/MobilityNebula/pull/14) (and follow-up operator-add PRs): + +| Operator | YAMLs using it | +|---|---| +| `edwithin_tgeo_geo(lon, lat, t, geom, d)` | Q3 × 3 forms (radius predicate, `POINT`), Q4 × 3 forms (region containment, `POLYGON` with `d=0.0`), Q5 × 3 forms (upstream near-P filter), Q8 × 3 forms (segment predicate, `LINESTRING`) | +| `TEMPORAL_SEQUENCE(lon, lat, t)` (aggregation) | Q2 × 3 forms (per-window trajectory) | +| `TEMPORAL_LENGTH(lon, lat, t)` (aggregation, MEOS `tpoint_length` under the hood) | Q6 × 3 forms (cumulative distance) | +| `PAIR_MEETING(lon, lat, t, vehicle_id)` (aggregation, MEOS `geog_dwithin` per pair under the hood) | Q5 × 3 forms (meeting pairs) | +| `CROSS_DISTANCE(lon, lat, t, vehicle_id)` (aggregation, MEOS `nad_tgeo_tgeo` under the hood) | Q9 × 3 forms (cross-vehicle distance) | + +`PAIR_MEETING` and `CROSS_DISTANCE` are added by this PR (and `TEMPORAL_LENGTH` is added by the parent #16); the rest are pre-existing. + +## Streaming-semantics tier overlay + +Each BerlinMOD-Q in this scaffold falls into one of the four streaming-execution tiers used by the per-binding wirings work across the ecosystem. The vocabulary is the closed 7-value set proposed for the MEOS-API catalog as `objectModel.streamingSemantics` (see the MEOS-API #10 sibling-facet RFC). + +The mapping makes the cross-binding picture explicit — a Q's tier on NebulaStream is the same tier it would land in on Flink / Kafka. The right-most column points to the equivalent generic wiring on Flink (where adopters consume the v4 baseline through generic DataStream wrappers). + +| Tier | BerlinMOD-Q | NebulaStream realization | Equivalent Flink wiring | +|---|---|---|---| +| `stateless` | Q1 (distinct-vehicle observation) | Simple SQL aggregation; no MEOS handle | `MeosStatelessMap` / `MeosStatelessFilter` | +| `bounded-state` | Q2, Q3, Q4, Q7 (per-vehicle / per-POI predicate state), Q8 | Aggregations that hold per-key latest position (TEMPORAL_SEQUENCE pattern); single MEOS-temporal evaluation | `MeosBoundedStateMap` (per-key `ValueState`) | +| `windowed` | Q6 (per-window trajectory length) | Custom MEOS aggregation closing the window once and emitting a scalar (`TEMPORAL_LENGTH`) | `MeosWindowedAggregate` (window-close-only) | +| `cross-stream` | Q5 (pair meeting), Q9 (cross-vehicle distance) | Four-field aggregations holding per-(vehicle-pair) state inside one operator (`PAIR_MEETING`, `CROSS_DISTANCE`) — same row-set sees all vehicles, so the "stream-self-join" is a single-aggregation enumeration rather than two streams | `MeosCrossStreamJoin` (`KeyedStream.intervalJoin`) | +| `io-meta` / `sequence-only` | — | not exercised by the BerlinMOD-9 set | n/a | + +### Why the cross-stream tier looks different on NebulaStream + +On Flink, the cross-stream tier maps to `KeyedStream.intervalJoin(other)` — two distinct keyed streams paired within a time bound. On NebulaStream, the same semantic is realized inside a single windowed aggregation that holds per-(vehicle-pair) state and enumerates pairs at window close. The two are equivalent: both materialize the Cartesian-product evaluation, just at different points in the operator topology. The tier classification is on the **MEOS semantic**, not on the engine pattern — and Q5 / Q9 are unambiguously `cross-stream` regardless of which engine realizes them. + +### Why Q7 is bounded-state, not windowed + +Q7 ("first passage of each vehicle through each POI") would naturally read as windowed (per-window minimum). It's classified bounded-state here because the NebulaStream scaffold expresses it as a per-POI fan-out (one YAML per POI), each YAML computing the per-vehicle latest-known position predicate and selecting the per-(vehicle, POI) earliest qualifying timestamp inside the window. The state per (vehicle, POI) is bounded; no per-window reduction across the full sequence is needed. + +## Sibling parity references + +- **MobilityFlink** — same nine queries × three forms on Flink. Original scaffold landed; the per-tier wiring infrastructure that mechanically wraps any of the 2,097 generated MEOS facade methods into Flink DataStream operators lives in the [`org.mobilitydb.flink.meos.wirings`](https://github.com/MobilityDB/MobilityFlink/blob/main/flink-processor/src/main/java/org/mobilitydb/flink/meos/wirings) package (5 generic classes covering 100% of the streamable + io-meta surface; a capstone demo composes all four tiers into one pipeline). +- **MobilityKafka** — same nine queries × three forms on Kafka Streams, with a codegen mirror of the MEOS facade in [`org.mobilitydb.kafka.meos`](https://github.com/MobilityDB/MobilityKafka/blob/main/kafka-streams-app/src/main/java/org/mobilitydb/kafka/meos). +- **MobilityDB-BerlinMOD** — batch BerlinMOD-9 cross-platform reports; the snapshot form on the streaming side converges to those outputs as the watermark advances. + +## Running + +Each YAML follows the same pattern as the SNCB queries (TCP CSV source, file sink). The expected execution flow: + +1. Start NebulaStream (or `MobilityNebula` docker-runtime). +2. Stream the sample CSV from `Input/input_berlinmod.csv` over TCP port `32325` (e.g. via `nc -l -p 32325 < Input/input_berlinmod.csv` or the project's existing TCP-source tooling). +3. Submit one of the YAMLs to the NebulaStream coordinator. +4. The output appears in `/workspace/Output/output_berlinmod__
.csv`. + +YAML structure has been validated with `python3 -c "import yaml; yaml.safe_load(open(f))"` for every file. Runtime verification is gated on the NebulaStream test harness; the YAMLs are intentionally additive and the SNCB Q-series remains untouched. diff --git a/grpc/SerializableVariantDescriptor.proto b/grpc/SerializableVariantDescriptor.proto index 97b9ff1894..e276149e4e 100644 --- a/grpc/SerializableVariantDescriptor.proto +++ b/grpc/SerializableVariantDescriptor.proto @@ -66,6 +66,12 @@ message SerializableAggregationFunction { string type = 1; SerializableFunction on_field = 2; SerializableFunction as_field = 3; + repeated SerializableFunction extra_fields = 4; + // Query-literal constants for parameterized aggregates (e.g. a windowed + // box/span/set predicate's threshold operand, or a meeting-distance). Parsed + // at plan time and round-tripped here so the constant survives plan + // serialization rather than falling back to a default. + repeated string literals = 5; } message AggregationFunctionList { diff --git a/nes-logical-operators/include/Functions/Meos/AboveStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AboveStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..b31cce3b48 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AboveStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event above_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `above_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AboveStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AboveStboxStbox"; + + AboveStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AboveStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AboveStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..1abcbe22a5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AboveStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event above_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `above_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AboveStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AboveStboxTspatial"; + + AboveStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AboveTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AboveTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..a42a7a120a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AboveTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event above_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `above_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AboveTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AboveTspatialStbox"; + + AboveTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AboveTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AboveTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..fead8b0fe2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AboveTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event above_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `above_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AboveTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AboveTspatialTspatial"; + + AboveTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AdjacentStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AdjacentStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..7989670e5b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AdjacentStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event adjacent_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adjacent_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AdjacentStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AdjacentStboxStbox"; + + AdjacentStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AdjacentStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AdjacentStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..32c7af7c66 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AdjacentStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event adjacent_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adjacent_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AdjacentStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AdjacentStboxTspatial"; + + AdjacentStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AdjacentTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AdjacentTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..ac5979349f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AdjacentTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event adjacent_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adjacent_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AdjacentTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AdjacentTboxTnumber"; + + AdjacentTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AdjacentTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AdjacentTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..11987414fe --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AdjacentTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event adjacent_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adjacent_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AdjacentTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AdjacentTemporalTemporal"; + + AdjacentTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AdjacentTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AdjacentTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..ed756f0d8e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AdjacentTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event adjacent_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adjacent_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AdjacentTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AdjacentTnumberTbox"; + + AdjacentTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AdjacentTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AdjacentTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..4b4f707054 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AdjacentTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event adjacent_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adjacent_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AdjacentTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AdjacentTnumberTnumber"; + + AdjacentTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AdjacentTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AdjacentTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..76a8e5c509 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AdjacentTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event adjacent_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adjacent_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AdjacentTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AdjacentTspatialStbox"; + + AdjacentTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AdjacentTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AdjacentTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..e2357ddad5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AdjacentTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event adjacent_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adjacent_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AdjacentTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AdjacentTspatialTspatial"; + + AdjacentTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AfterStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AfterStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..2eed456c11 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AfterStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event after_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `after_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AfterStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AfterStboxStbox"; + + AfterStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AfterStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AfterStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..14f633906e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AfterStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event after_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `after_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AfterStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AfterStboxTspatial"; + + AfterStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AfterTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AfterTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..b6687303c4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AfterTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event after_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `after_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AfterTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AfterTboxTnumber"; + + AfterTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AfterTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AfterTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..3949e74a70 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AfterTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event after_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `after_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AfterTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AfterTemporalTemporal"; + + AfterTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AfterTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AfterTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..59ce4685ef --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AfterTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event after_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `after_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AfterTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AfterTnumberTbox"; + + AfterTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AfterTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AfterTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..0518ea7be3 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AfterTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event after_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `after_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AfterTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AfterTnumberTnumber"; + + AfterTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AfterTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AfterTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..5b976b37ba --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AfterTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event after_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `after_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AfterTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AfterTspatialStbox"; + + AfterTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AfterTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AfterTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..921b68ce78 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AfterTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event after_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `after_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AfterTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AfterTspatialTspatial"; + + AfterTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..1af6f92d05 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqFloatTfloat"; + + AlwaysEqFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..bb52df5eb8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqIntTint"; + + AlwaysEqIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqTboolBoolLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqTboolBoolLogicalFunction.hpp new file mode 100644 index 0000000000..2640f2e68e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqTboolBoolLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_eq_tbool_bool: single-instant tbool against a scalar -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_tbool_bool`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqTboolBoolLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqTboolBool"; + + AlwaysEqTboolBoolLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqTcbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqTcbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..5abcb60dfe --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqTcbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_eq_tcbuffer_cbuffer: single-instant tcbuffer vs a static cbuffer -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqTcbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqTcbufferCbuffer"; + + AlwaysEqTcbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbuffer); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqTcbufferTcbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqTcbufferTcbufferLogicalFunction.hpp new file mode 100644 index 0000000000..43863a3376 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqTcbufferTcbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_eq_tcbuffer_tcbuffer between two single-instant tcbuffers -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqTcbufferTcbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqTcbufferTcbuffer"; + + AlwaysEqTcbufferTcbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..c6e5865d93 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqTemporalTemporal"; + + AlwaysEqTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..9d2afe70cb --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqTfloatFloat"; + + AlwaysEqTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqTgeoGeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqTgeoGeoLogicalFunction.hpp new file mode 100644 index 0000000000..8f3c27ee5b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqTgeoGeoLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_eq_tgeo_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqTgeoGeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqTgeoGeo"; + + AlwaysEqTgeoGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqTgeoTgeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqTgeoTgeoLogicalFunction.hpp new file mode 100644 index 0000000000..9d1f3bd554 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqTgeoTgeoLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_eq_tgeo_tgeo between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqTgeoTgeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqTgeoTgeo"; + + AlwaysEqTgeoTgeoLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysEqTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysEqTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..ef0a746563 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysEqTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_eq_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysEqTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysEqTintInt"; + + AlwaysEqTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGeFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGeFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..2daabbe81b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGeFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ge_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGeFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGeFloatTfloat"; + + AlwaysGeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGeIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGeIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..4284565b1e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGeIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ge_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGeIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGeIntTint"; + + AlwaysGeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGeTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGeTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..a2cc38db8e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGeTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ge_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGeTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGeTemporalTemporal"; + + AlwaysGeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGeTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGeTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..cf68e8c8ba --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGeTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ge_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGeTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGeTfloatFloat"; + + AlwaysGeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGeTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGeTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..9ae9700910 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGeTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ge_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGeTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGeTintInt"; + + AlwaysGeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGtFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGtFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..d89efff3c2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGtFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_gt_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGtFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGtFloatTfloat"; + + AlwaysGtFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGtIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGtIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..0ff56b31b4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGtIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_gt_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGtIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGtIntTint"; + + AlwaysGtIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGtTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGtTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..c418ff4eed --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGtTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_gt_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGtTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGtTemporalTemporal"; + + AlwaysGtTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGtTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGtTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..59a18f703a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGtTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_gt_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGtTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGtTfloatFloat"; + + AlwaysGtTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysGtTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysGtTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..9878ed1071 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysGtTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_gt_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysGtTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysGtTintInt"; + + AlwaysGtTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLeFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLeFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..8b88d7fed0 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLeFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_le_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLeFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLeFloatTfloat"; + + AlwaysLeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLeIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLeIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..baa8f1998f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLeIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_le_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLeIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLeIntTint"; + + AlwaysLeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLeTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLeTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..8d33a5f5f1 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLeTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_le_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLeTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLeTemporalTemporal"; + + AlwaysLeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLeTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLeTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..cd7ce618df --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLeTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_le_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLeTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLeTfloatFloat"; + + AlwaysLeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLeTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLeTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..fa86b099b7 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLeTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_le_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLeTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLeTintInt"; + + AlwaysLeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLtFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLtFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..a6b0787f30 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLtFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_lt_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLtFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLtFloatTfloat"; + + AlwaysLtFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLtIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLtIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..cef6643c5d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLtIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_lt_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLtIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLtIntTint"; + + AlwaysLtIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLtTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLtTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..1b008321fc --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLtTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_lt_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLtTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLtTemporalTemporal"; + + AlwaysLtTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLtTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLtTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..83acb47d11 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLtTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_lt_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLtTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLtTfloatFloat"; + + AlwaysLtTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysLtTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysLtTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..7f184810a2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysLtTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_lt_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysLtTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysLtTintInt"; + + AlwaysLtTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..cb3b6cec3b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeFloatTfloat"; + + AlwaysNeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..3943aff2d3 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeIntTint"; + + AlwaysNeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeTboolBoolLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeTboolBoolLogicalFunction.hpp new file mode 100644 index 0000000000..f980e7e72b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeTboolBoolLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_ne_tbool_bool: single-instant tbool against a scalar -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_tbool_bool`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeTboolBoolLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeTboolBool"; + + AlwaysNeTboolBoolLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeTcbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeTcbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..66804114a7 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeTcbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_ne_tcbuffer_cbuffer: single-instant tcbuffer vs a static cbuffer -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeTcbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeTcbufferCbuffer"; + + AlwaysNeTcbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbuffer); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeTcbufferTcbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeTcbufferTcbufferLogicalFunction.hpp new file mode 100644 index 0000000000..e452d31394 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeTcbufferTcbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_ne_tcbuffer_tcbuffer between two single-instant tcbuffers -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeTcbufferTcbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeTcbufferTcbuffer"; + + AlwaysNeTcbufferTcbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..d0d77509c8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeTemporalTemporal"; + + AlwaysNeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..c4f10d2835 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeTfloatFloat"; + + AlwaysNeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeTgeoGeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeTgeoGeoLogicalFunction.hpp new file mode 100644 index 0000000000..c1359b6c69 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeTgeoGeoLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_ne_tgeo_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeTgeoGeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeTgeoGeo"; + + AlwaysNeTgeoGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeTgeoTgeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeTgeoTgeoLogicalFunction.hpp new file mode 100644 index 0000000000..ec4a7374d8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeTgeoTgeoLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always_ne_tgeo_tgeo between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeTgeoTgeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeTgeoTgeo"; + + AlwaysNeTgeoTgeoLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AlwaysNeTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AlwaysNeTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..06ba65f7d9 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AlwaysNeTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `always_ne_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AlwaysNeTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AlwaysNeTintInt"; + + AlwaysNeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/AtouchesTpointGeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/AtouchesTpointGeoLogicalFunction.hpp new file mode 100644 index 0000000000..2e30b352b5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/AtouchesTpointGeoLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event atouches_tpoint_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tpoint_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class AtouchesTpointGeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "AtouchesTpointGeo"; + + AtouchesTpointGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BackStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BackStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..5a6c0b54ca --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BackStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event back_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `back_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BackStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BackStboxStbox"; + + BackStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BackStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BackStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..da28ef60b2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BackStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event back_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `back_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BackStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BackStboxTspatial"; + + BackStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BackTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BackTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..bd6d2cfcb1 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BackTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event back_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `back_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BackTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BackTspatialStbox"; + + BackTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BackTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BackTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..c35d0fba1d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BackTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event back_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `back_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BackTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BackTspatialTspatial"; + + BackTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BeforeStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BeforeStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..6b71fa6ba6 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BeforeStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event before_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `before_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BeforeStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BeforeStboxStbox"; + + BeforeStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BeforeStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BeforeStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..784faa16bd --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BeforeStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event before_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `before_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BeforeStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BeforeStboxTspatial"; + + BeforeStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BeforeTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BeforeTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..3ae61b39ee --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BeforeTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event before_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `before_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BeforeTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BeforeTboxTnumber"; + + BeforeTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BeforeTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BeforeTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..47c65e9962 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BeforeTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event before_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `before_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BeforeTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BeforeTemporalTemporal"; + + BeforeTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BeforeTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BeforeTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..e032447994 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BeforeTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event before_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `before_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BeforeTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BeforeTnumberTbox"; + + BeforeTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BeforeTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BeforeTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..d64b00eb0d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BeforeTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event before_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `before_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BeforeTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BeforeTnumberTnumber"; + + BeforeTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BeforeTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BeforeTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..0c803e5026 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BeforeTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event before_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `before_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BeforeTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BeforeTspatialStbox"; + + BeforeTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BeforeTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BeforeTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..92cfbeaa8b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BeforeTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event before_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `before_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BeforeTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BeforeTspatialTspatial"; + + BeforeTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BelowStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BelowStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..207fca0cd9 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BelowStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event below_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `below_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BelowStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BelowStboxStbox"; + + BelowStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BelowStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BelowStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..ed8502d5b9 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BelowStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event below_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `below_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BelowStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BelowStboxTspatial"; + + BelowStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BelowTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BelowTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..5402704500 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BelowTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event below_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `below_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BelowTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BelowTspatialStbox"; + + BelowTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/BelowTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/BelowTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..86295bb3d2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/BelowTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event below_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `below_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class BelowTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "BelowTspatialTspatial"; + + BelowTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainedStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainedStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..3853df882c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainedStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contained_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contained_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainedStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainedStboxStbox"; + + ContainedStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainedStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainedStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..35666cd5a8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainedStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contained_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contained_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainedStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainedStboxTspatial"; + + ContainedStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainedTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainedTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..739f82ccb1 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainedTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contained_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contained_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainedTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainedTboxTnumber"; + + ContainedTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainedTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainedTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..551d35636c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainedTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contained_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contained_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainedTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainedTemporalTemporal"; + + ContainedTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainedTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainedTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..6e00d9cdf7 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainedTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contained_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contained_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainedTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainedTnumberTbox"; + + ContainedTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainedTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainedTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..6fa26c1830 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainedTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contained_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contained_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainedTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainedTnumberTnumber"; + + ContainedTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainedTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainedTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..d4c486b30c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainedTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contained_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contained_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainedTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainedTspatialStbox"; + + ContainedTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainedTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainedTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..a9eeb25755 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainedTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contained_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contained_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainedTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainedTspatialTspatial"; + + ContainedTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainsStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainsStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..1839b5060a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainsStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contains_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contains_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainsStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainsStboxStbox"; + + ContainsStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainsStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainsStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..2dc554776f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainsStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contains_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contains_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainsStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainsStboxTspatial"; + + ContainsStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainsTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainsTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..5d73291bcf --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainsTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contains_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contains_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainsTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainsTboxTnumber"; + + ContainsTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainsTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainsTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..b078c42089 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainsTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contains_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contains_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainsTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainsTemporalTemporal"; + + ContainsTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainsTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainsTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..88ca98662a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainsTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contains_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contains_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainsTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainsTnumberTbox"; + + ContainsTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainsTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainsTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..8f30352b2c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainsTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contains_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contains_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainsTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainsTnumberTnumber"; + + ContainsTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainsTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainsTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..24d51d0ff4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainsTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contains_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contains_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainsTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainsTspatialStbox"; + + ContainsTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/ContainsTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/ContainsTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..d122d5a77c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/ContainsTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event contains_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `contains_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class ContainsTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "ContainsTspatialTspatial"; + + ContainsTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EtouchesTpointGeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EtouchesTpointGeoLogicalFunction.hpp new file mode 100644 index 0000000000..7687b64551 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EtouchesTpointGeoLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event etouches_tpoint_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tpoint_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EtouchesTpointGeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EtouchesTpointGeo"; + + EtouchesTpointGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..e346294ef4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqFloatTfloat"; + + EverEqFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..4ea9077e63 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqIntTint"; + + EverEqIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqTboolBoolLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqTboolBoolLogicalFunction.hpp new file mode 100644 index 0000000000..ced5c0590d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqTboolBoolLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_eq_tbool_bool: single-instant tbool against a scalar -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_tbool_bool`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqTboolBoolLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqTboolBool"; + + EverEqTboolBoolLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqTcbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqTcbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..4cd83ad3f8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqTcbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_eq_tcbuffer_cbuffer: single-instant tcbuffer vs a static cbuffer -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqTcbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqTcbufferCbuffer"; + + EverEqTcbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbuffer); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqTcbufferTcbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqTcbufferTcbufferLogicalFunction.hpp new file mode 100644 index 0000000000..5d1ccbbd2f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqTcbufferTcbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_eq_tcbuffer_tcbuffer between two single-instant tcbuffers -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqTcbufferTcbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqTcbufferTcbuffer"; + + EverEqTcbufferTcbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..177f9fd56c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqTemporalTemporal"; + + EverEqTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..0c722ab7ba --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqTfloatFloat"; + + EverEqTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqTgeoGeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqTgeoGeoLogicalFunction.hpp new file mode 100644 index 0000000000..114d85c6c5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqTgeoGeoLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_eq_tgeo_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqTgeoGeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqTgeoGeo"; + + EverEqTgeoGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqTgeoTgeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqTgeoTgeoLogicalFunction.hpp new file mode 100644 index 0000000000..a44771da3e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqTgeoTgeoLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_eq_tgeo_tgeo between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqTgeoTgeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqTgeoTgeo"; + + EverEqTgeoTgeoLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverEqTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverEqTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..8465ba4b04 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverEqTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_eq_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverEqTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverEqTintInt"; + + EverEqTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGeFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGeFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..d73867d28f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGeFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ge_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGeFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGeFloatTfloat"; + + EverGeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGeIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGeIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..f01593fd88 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGeIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ge_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGeIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGeIntTint"; + + EverGeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGeTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGeTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..d983997710 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGeTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ge_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGeTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGeTemporalTemporal"; + + EverGeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGeTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGeTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..13c0b14eb2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGeTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ge_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGeTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGeTfloatFloat"; + + EverGeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGeTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGeTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..ced8ae6667 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGeTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ge_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGeTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGeTintInt"; + + EverGeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGtFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGtFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..f006ccfa43 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGtFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_gt_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGtFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGtFloatTfloat"; + + EverGtFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGtIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGtIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..69fbae92ef --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGtIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_gt_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGtIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGtIntTint"; + + EverGtIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGtTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGtTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..08a4fe98b4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGtTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_gt_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGtTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGtTemporalTemporal"; + + EverGtTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGtTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGtTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..85b9c6a97b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGtTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_gt_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGtTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGtTfloatFloat"; + + EverGtTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverGtTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverGtTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..6b44b94ded --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverGtTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_gt_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverGtTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverGtTintInt"; + + EverGtTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLeFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLeFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..c0bd3f7254 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLeFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_le_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLeFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLeFloatTfloat"; + + EverLeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLeIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLeIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..33748e20b5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLeIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_le_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLeIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLeIntTint"; + + EverLeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLeTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLeTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..f366004e0a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLeTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_le_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLeTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLeTemporalTemporal"; + + EverLeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLeTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLeTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..f130a946b8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLeTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_le_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLeTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLeTfloatFloat"; + + EverLeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLeTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLeTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..f9e14f89ef --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLeTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_le_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLeTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLeTintInt"; + + EverLeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLtFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLtFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..c2d77d6fba --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLtFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_lt_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLtFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLtFloatTfloat"; + + EverLtFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLtIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLtIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..e91360d68f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLtIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_lt_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLtIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLtIntTint"; + + EverLtIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLtTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLtTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..c168ebfebf --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLtTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_lt_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLtTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLtTemporalTemporal"; + + EverLtTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLtTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLtTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..335252ff7a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLtTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_lt_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLtTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLtTfloatFloat"; + + EverLtTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverLtTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverLtTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..33d3720f44 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverLtTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_lt_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverLtTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverLtTintInt"; + + EverLtTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeFloatTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeFloatTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..d3f27dd359 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeFloatTfloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_float_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeFloatTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeFloatTfloat"; + + EverNeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeIntTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeIntTintLogicalFunction.hpp new file mode 100644 index 0000000000..86cec57e4a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeIntTintLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_int_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeIntTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeIntTint"; + + EverNeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeTboolBoolLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeTboolBoolLogicalFunction.hpp new file mode 100644 index 0000000000..f6718c3b3c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeTboolBoolLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_ne_tbool_bool: single-instant tbool against a scalar -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_tbool_bool`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeTboolBoolLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeTboolBool"; + + EverNeTboolBoolLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeTcbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeTcbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..9e07077fb3 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeTcbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_ne_tcbuffer_cbuffer: single-instant tcbuffer vs a static cbuffer -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeTcbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeTcbufferCbuffer"; + + EverNeTcbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbuffer); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeTcbufferTcbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeTcbufferTcbufferLogicalFunction.hpp new file mode 100644 index 0000000000..03cb3ebeeb --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeTcbufferTcbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_ne_tcbuffer_tcbuffer between two single-instant tcbuffers -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeTcbufferTcbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeTcbufferTcbuffer"; + + EverNeTcbufferTcbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..773a7f0c6e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeTemporalTemporal"; + + EverNeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeTfloatFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeTfloatFloatLogicalFunction.hpp new file mode 100644 index 0000000000..6e48547f3c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeTfloatFloatLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeTfloatFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeTfloatFloat"; + + EverNeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeTgeoGeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeTgeoGeoLogicalFunction.hpp new file mode 100644 index 0000000000..5fa6ca5898 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeTgeoGeoLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_ne_tgeo_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeTgeoGeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeTgeoGeo"; + + EverNeTgeoGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeTgeoTgeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeTgeoTgeoLogicalFunction.hpp new file mode 100644 index 0000000000..5dfcaba2e4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeTgeoTgeoLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever_ne_tgeo_tgeo between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeTgeoTgeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeTgeoTgeo"; + + EverNeTgeoTgeoLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/EverNeTintIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/EverNeTintIntLogicalFunction.hpp new file mode 100644 index 0000000000..7f6e535db8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/EverNeTintIntLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ever_ne_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class EverNeTintIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "EverNeTintInt"; + + EverNeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/FrontStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/FrontStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..1fad5af2fc --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/FrontStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event front_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `front_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class FrontStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "FrontStboxStbox"; + + FrontStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/FrontStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/FrontStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..f5b82ccffa --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/FrontStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event front_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `front_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class FrontStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "FrontStboxTspatial"; + + FrontStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/FrontTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/FrontTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..1496e1c1bb --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/FrontTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event front_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `front_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class FrontTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "FrontTspatialStbox"; + + FrontTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/FrontTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/FrontTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..2855410089 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/FrontTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event front_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `front_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class FrontTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "FrontTspatialTspatial"; + + FrontTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/LeftStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/LeftStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..22be93d91b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/LeftStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event left_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `left_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class LeftStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "LeftStboxStbox"; + + LeftStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/LeftStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/LeftStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..f00ffcfb24 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/LeftStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event left_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `left_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class LeftStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "LeftStboxTspatial"; + + LeftStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/LeftTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/LeftTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..0bd2a0baf5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/LeftTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event left_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `left_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class LeftTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "LeftTboxTnumber"; + + LeftTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/LeftTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/LeftTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..c75d667733 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/LeftTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event left_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `left_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class LeftTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "LeftTnumberTbox"; + + LeftTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/LeftTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/LeftTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..e0d734c666 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/LeftTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event left_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `left_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class LeftTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "LeftTnumberTnumber"; + + LeftTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/LeftTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/LeftTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..c3995f65a6 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/LeftTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event left_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `left_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class LeftTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "LeftTspatialStbox"; + + LeftTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/LeftTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/LeftTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..5b6a622079 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/LeftTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event left_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `left_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class LeftTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "LeftTspatialTspatial"; + + LeftTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..7db637843a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_stbox_stbox: two per-vehicle extent STBoxes -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadStboxStbox"; + + NadStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadTcbufferStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadTcbufferStboxLogicalFunction.hpp new file mode 100644 index 0000000000..f2e262676a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadTcbufferStboxLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_tcbuffer_stbox: single-instant tcbuffer against a stbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tcbuffer_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadTcbufferStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadTcbufferStbox"; + + NadTcbufferStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadTfloatTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadTfloatTboxLogicalFunction.hpp new file mode 100644 index 0000000000..7739f8c6ed --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadTfloatTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_tfloat_tbox: single-instant tfloat against a tbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tfloat_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadTfloatTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadTfloatTbox"; + + NadTfloatTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadTgeoStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadTgeoStboxLogicalFunction.hpp new file mode 100644 index 0000000000..dd06895d1a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadTgeoStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_tgeo_stbox: single-instant tgeompoint against a stbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tgeo_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadTgeoStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadTgeoStbox"; + + NadTgeoStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadTintTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadTintTboxLogicalFunction.hpp new file mode 100644 index 0000000000..c07a8bd410 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadTintTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_tint_tbox: single-instant tint against a tbox literal -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tint_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadTintTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadTintTbox"; + + NadTintTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadTnpointGeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadTnpointGeoLogicalFunction.hpp new file mode 100644 index 0000000000..479cbb0d5e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadTnpointGeoLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_tnpoint_geo: single-instant tnpoint against a static geometry -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tnpoint_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadTnpointGeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadTnpointGeo"; + + NadTnpointGeoLogicalFunction(LogicalFunction rid, + LogicalFunction frac, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadTnpointStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadTnpointStboxLogicalFunction.hpp new file mode 100644 index 0000000000..f51835cdee --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadTnpointStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_tnpoint_stbox: single-instant tnpoint against a stbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tnpoint_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadTnpointStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadTnpointStbox"; + + NadTnpointStboxLogicalFunction(LogicalFunction rid, + LogicalFunction frac, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadTposeGeoLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadTposeGeoLogicalFunction.hpp new file mode 100644 index 0000000000..39cc1d306d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadTposeGeoLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_tpose_geo: single-instant tpose against a static geometry -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tpose_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadTposeGeoLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadTposeGeo"; + + NadTposeGeoLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/NadTposeStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/NadTposeStboxLogicalFunction.hpp new file mode 100644 index 0000000000..7c5a8632b7 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/NadTposeStboxLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nad_tpose_stbox: single-instant tpose against a stbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tpose_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class NadTposeStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "NadTposeStbox"; + + NadTposeStboxLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OveraboveStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OveraboveStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..58a5faced8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OveraboveStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overabove_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overabove_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OveraboveStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OveraboveStboxStbox"; + + OveraboveStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OveraboveStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OveraboveStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..d9d2f238be --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OveraboveStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overabove_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overabove_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OveraboveStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OveraboveStboxTspatial"; + + OveraboveStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OveraboveTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OveraboveTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..a4a389ccf6 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OveraboveTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overabove_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overabove_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OveraboveTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OveraboveTspatialStbox"; + + OveraboveTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OveraboveTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OveraboveTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..9256c61369 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OveraboveTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overabove_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overabove_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OveraboveTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OveraboveTspatialTspatial"; + + OveraboveTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverafterStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverafterStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..5fa0c6b7fd --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverafterStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overafter_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overafter_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverafterStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverafterStboxStbox"; + + OverafterStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverafterStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverafterStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..745db4518d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverafterStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overafter_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overafter_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverafterStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverafterStboxTspatial"; + + OverafterStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverafterTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverafterTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..af469fc3be --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverafterTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overafter_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overafter_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverafterTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverafterTboxTnumber"; + + OverafterTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverafterTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverafterTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..db8930b60f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverafterTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overafter_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overafter_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverafterTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverafterTemporalTemporal"; + + OverafterTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverafterTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverafterTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..5fafb37c90 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverafterTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overafter_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overafter_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverafterTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverafterTnumberTbox"; + + OverafterTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverafterTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverafterTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..07f948f0b8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverafterTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overafter_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overafter_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverafterTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverafterTnumberTnumber"; + + OverafterTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverafterTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverafterTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..20a235c354 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverafterTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overafter_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overafter_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverafterTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverafterTspatialStbox"; + + OverafterTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverafterTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverafterTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..e0ebb270e6 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverafterTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overafter_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overafter_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverafterTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverafterTspatialTspatial"; + + OverafterTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbackStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbackStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..c335a67f2a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbackStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overback_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overback_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbackStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbackStboxStbox"; + + OverbackStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbackStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbackStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..20cafed675 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbackStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overback_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overback_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbackStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbackStboxTspatial"; + + OverbackStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbackTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbackTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..7e5f4fb20e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbackTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overback_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overback_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbackTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbackTspatialStbox"; + + OverbackTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbackTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbackTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..71a406977f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbackTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overback_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overback_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbackTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbackTspatialTspatial"; + + OverbackTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbeforeStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbeforeStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..2fdbf42fd7 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbeforeStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbefore_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbefore_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbeforeStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbeforeStboxStbox"; + + OverbeforeStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbeforeStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbeforeStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..8536edb9e1 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbeforeStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbefore_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbefore_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbeforeStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbeforeStboxTspatial"; + + OverbeforeStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbeforeTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbeforeTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..43cdba7eea --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbeforeTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbefore_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbefore_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbeforeTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbeforeTboxTnumber"; + + OverbeforeTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbeforeTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbeforeTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..bbe19ee1c3 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbeforeTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbefore_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbefore_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbeforeTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbeforeTemporalTemporal"; + + OverbeforeTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbeforeTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbeforeTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..6cb48d9459 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbeforeTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbefore_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbefore_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbeforeTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbeforeTnumberTbox"; + + OverbeforeTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbeforeTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbeforeTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..1fd3b8f13d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbeforeTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbefore_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbefore_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbeforeTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbeforeTnumberTnumber"; + + OverbeforeTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbeforeTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbeforeTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..8d039403b5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbeforeTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbefore_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbefore_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbeforeTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbeforeTspatialStbox"; + + OverbeforeTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbeforeTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbeforeTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..fec2af7874 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbeforeTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbefore_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbefore_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbeforeTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbeforeTspatialTspatial"; + + OverbeforeTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbelowStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbelowStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..4ecbd705df --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbelowStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbelow_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbelow_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbelowStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbelowStboxStbox"; + + OverbelowStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbelowStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbelowStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..e662ee4129 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbelowStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbelow_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbelow_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbelowStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbelowStboxTspatial"; + + OverbelowStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbelowTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbelowTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..68f502ef95 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbelowTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbelow_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbelow_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbelowTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbelowTspatialStbox"; + + OverbelowTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverbelowTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverbelowTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..104872cc84 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverbelowTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overbelow_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overbelow_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverbelowTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverbelowTspatialTspatial"; + + OverbelowTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverfrontStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverfrontStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..cdbdcfc4a8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverfrontStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overfront_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overfront_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverfrontStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverfrontStboxStbox"; + + OverfrontStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverfrontStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverfrontStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..541f02fad6 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverfrontStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overfront_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overfront_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverfrontStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverfrontStboxTspatial"; + + OverfrontStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverfrontTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverfrontTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..6d93874c54 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverfrontTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overfront_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overfront_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverfrontTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverfrontTspatialStbox"; + + OverfrontTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverfrontTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverfrontTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..6c0febb5cd --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverfrontTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overfront_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overfront_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverfrontTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverfrontTspatialTspatial"; + + OverfrontTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverlapsStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverlapsStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..01c84f3216 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverlapsStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overlaps_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overlaps_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverlapsStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverlapsStboxStbox"; + + OverlapsStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverlapsStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverlapsStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..1b1e364b9e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverlapsStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overlaps_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overlaps_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverlapsStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverlapsStboxTspatial"; + + OverlapsStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverlapsTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverlapsTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..d3f2282b89 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverlapsTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overlaps_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overlaps_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverlapsTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverlapsTboxTnumber"; + + OverlapsTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverlapsTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverlapsTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..4ce3e05efa --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverlapsTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overlaps_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overlaps_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverlapsTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverlapsTemporalTemporal"; + + OverlapsTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverlapsTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverlapsTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..fb70e8483a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverlapsTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overlaps_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overlaps_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverlapsTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverlapsTnumberTbox"; + + OverlapsTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverlapsTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverlapsTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..ab9246ec97 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverlapsTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overlaps_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overlaps_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverlapsTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverlapsTnumberTnumber"; + + OverlapsTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverlapsTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverlapsTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..dc1a1fdcd9 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverlapsTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overlaps_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overlaps_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverlapsTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverlapsTspatialStbox"; + + OverlapsTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverlapsTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverlapsTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..b65b17f329 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverlapsTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overlaps_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overlaps_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverlapsTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverlapsTspatialTspatial"; + + OverlapsTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverleftStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverleftStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..f9f82cab5c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverleftStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overleft_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overleft_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverleftStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverleftStboxStbox"; + + OverleftStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverleftStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverleftStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..b6bf15f783 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverleftStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overleft_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overleft_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverleftStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverleftStboxTspatial"; + + OverleftStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverleftTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverleftTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..a38c528eb9 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverleftTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overleft_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overleft_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverleftTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverleftTboxTnumber"; + + OverleftTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverleftTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverleftTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..671cfbb608 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverleftTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overleft_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overleft_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverleftTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverleftTnumberTbox"; + + OverleftTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverleftTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverleftTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..7fb6cae8cc --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverleftTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overleft_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overleft_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverleftTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverleftTnumberTnumber"; + + OverleftTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverleftTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverleftTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..28ce3fd0b4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverleftTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overleft_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overleft_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverleftTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverleftTspatialStbox"; + + OverleftTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverleftTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverleftTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..a8ed017752 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverleftTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overleft_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overleft_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverleftTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverleftTspatialTspatial"; + + OverleftTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverrightStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverrightStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..fb844e22e1 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverrightStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overright_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overright_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverrightStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverrightStboxStbox"; + + OverrightStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverrightStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverrightStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..ea6bc8c02d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverrightStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overright_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overright_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverrightStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverrightStboxTspatial"; + + OverrightStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverrightTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverrightTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..7b1c04284f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverrightTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overright_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overright_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverrightTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverrightTboxTnumber"; + + OverrightTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverrightTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverrightTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..a05d956101 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverrightTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overright_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overright_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverrightTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverrightTnumberTbox"; + + OverrightTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverrightTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverrightTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..68f88fe624 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverrightTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overright_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overright_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverrightTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverrightTnumberTnumber"; + + OverrightTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverrightTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverrightTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..6283b86939 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverrightTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overright_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overright_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverrightTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverrightTspatialStbox"; + + OverrightTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/OverrightTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/OverrightTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..210e53a531 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/OverrightTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event overright_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `overright_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class OverrightTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "OverrightTspatialTspatial"; + + OverrightTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/RightStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/RightStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..d511572c82 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/RightStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event right_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `right_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class RightStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "RightStboxStbox"; + + RightStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/RightStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/RightStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..85a428550c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/RightStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event right_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `right_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class RightStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "RightStboxTspatial"; + + RightStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/RightTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/RightTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..ea8b3eb45a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/RightTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event right_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `right_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class RightTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "RightTboxTnumber"; + + RightTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/RightTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/RightTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..89a8243cdd --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/RightTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event right_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `right_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class RightTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "RightTnumberTbox"; + + RightTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/RightTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/RightTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..909e1bd4e4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/RightTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event right_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `right_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class RightTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "RightTnumberTnumber"; + + RightTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/RightTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/RightTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..4098d5bbcd --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/RightTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event right_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `right_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class RightTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "RightTspatialStbox"; + + RightTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/RightTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/RightTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..8c391b4265 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/RightTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event right_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `right_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class RightTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "RightTspatialTspatial"; + + RightTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/SameStboxStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/SameStboxStboxLogicalFunction.hpp new file mode 100644 index 0000000000..afedde9637 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/SameStboxStboxLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event same_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `same_stbox_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class SameStboxStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "SameStboxStbox"; + + SameStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/SameStboxTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/SameStboxTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..ed3c961659 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/SameStboxTspatialLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event same_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `same_stbox_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class SameStboxTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "SameStboxTspatial"; + + SameStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/SameTboxTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/SameTboxTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..19548bc4b2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/SameTboxTnumberLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event same_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `same_tbox_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class SameTboxTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "SameTboxTnumber"; + + SameTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/SameTemporalTemporalLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/SameTemporalTemporalLogicalFunction.hpp new file mode 100644 index 0000000000..b88c3572f2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/SameTemporalTemporalLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event same_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `same_temporal_temporal`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class SameTemporalTemporalLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "SameTemporalTemporal"; + + SameTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/SameTnumberTboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/SameTnumberTboxLogicalFunction.hpp new file mode 100644 index 0000000000..132f038a12 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/SameTnumberTboxLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event same_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `same_tnumber_tbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class SameTnumberTboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "SameTnumberTbox"; + + SameTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/SameTnumberTnumberLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/SameTnumberTnumberLogicalFunction.hpp new file mode 100644 index 0000000000..57c668d4e4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/SameTnumberTnumberLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event same_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `same_tnumber_tnumber`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class SameTnumberTnumberLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "SameTnumberTnumber"; + + SameTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/SameTspatialStboxLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/SameTspatialStboxLogicalFunction.hpp new file mode 100644 index 0000000000..d38e27b563 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/SameTspatialStboxLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event same_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `same_tspatial_stbox`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class SameTspatialStboxLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "SameTspatialStbox"; + + SameTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/SameTspatialTspatialLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/SameTspatialTspatialLogicalFunction.hpp new file mode 100644 index 0000000000..aa02c96936 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/SameTspatialTspatialLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event same_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `same_tspatial_tspatial`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class SameTspatialTspatialLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "SameTspatialTspatial"; + + SameTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/StboxCmpLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/StboxCmpLogicalFunction.hpp new file mode 100644 index 0000000000..439531b542 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/StboxCmpLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event stbox_cmp: two per-vehicle extent STBoxes -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `stbox_cmp`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class StboxCmpLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "StboxCmp"; + + StboxCmpLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/StboxEqLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/StboxEqLogicalFunction.hpp new file mode 100644 index 0000000000..54a3ff9a0b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/StboxEqLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event stbox_eq: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `stbox_eq`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class StboxEqLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "StboxEq"; + + StboxEqLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/StboxGeLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/StboxGeLogicalFunction.hpp new file mode 100644 index 0000000000..7c0e5ed181 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/StboxGeLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event stbox_ge: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `stbox_ge`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class StboxGeLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "StboxGe"; + + StboxGeLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/StboxGtLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/StboxGtLogicalFunction.hpp new file mode 100644 index 0000000000..7a3c4c3d8c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/StboxGtLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event stbox_gt: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `stbox_gt`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class StboxGtLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "StboxGt"; + + StboxGtLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/StboxLeLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/StboxLeLogicalFunction.hpp new file mode 100644 index 0000000000..4024a8129e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/StboxLeLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event stbox_le: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `stbox_le`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class StboxLeLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "StboxLe"; + + StboxLeLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/StboxLtLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/StboxLtLogicalFunction.hpp new file mode 100644 index 0000000000..14f3b93882 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/StboxLtLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event stbox_lt: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `stbox_lt`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class StboxLtLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "StboxLt"; + + StboxLtLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/StboxNeLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/StboxNeLogicalFunction.hpp new file mode 100644 index 0000000000..715b035336 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/StboxNeLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event stbox_ne: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `stbox_ne`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class StboxNeLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "StboxNe"; + + StboxNeLogicalFunction(LogicalFunction box, + LogicalFunction arg0); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TboolEndValueLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TboolEndValueLogicalFunction.hpp new file mode 100644 index 0000000000..258d301509 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TboolEndValueLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tbool_end_value: bool accessor over a single-instant tbool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tbool_end_value`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TboolEndValueLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TboolEndValue"; + + TboolEndValueLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TboolStartValueLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TboolStartValueLogicalFunction.hpp new file mode 100644 index 0000000000..d548db2dc3 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TboolStartValueLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tbool_start_value: bool accessor over a single-instant tbool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tbool_start_value`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TboolStartValueLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TboolStartValue"; + + TboolStartValueLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TboolToTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TboolToTintLogicalFunction.hpp new file mode 100644 index 0000000000..ecc5e2ba45 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TboolToTintLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tbool_to_tint: single-instant tint transform, value extracted -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tbool_to_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TboolToTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TboolToTint"; + + TboolToTintLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TcbufferToTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TcbufferToTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..c8fe90bd3e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TcbufferToTfloatLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tcbuffer_to_tfloat: single-instant tcbuffer transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tcbuffer_to_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TcbufferToTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TcbufferToTfloat"; + + TcbufferToTfloatLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAContainsGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAContainsGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..befa25d025 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAContainsGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-contains between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acontains_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAContainsGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAContainsGeometry"; + + TemporalAContainsGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAContainsTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..4d5df38d20 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event a-contains between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acontains_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAContainsTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAContainsTCbufferCbuffer"; + + TemporalAContainsTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAContainsTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..08658e6eeb --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-contains between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acontains_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAContainsTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAContainsTCbuffer"; + + TemporalAContainsTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAContainsTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..11e0269fa6 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-contains between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acontains_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAContainsTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAContainsTGeometry"; + + TemporalAContainsTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAContainsTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..6526ba51a5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-contains between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acontains_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAContainsTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAContainsTNpointGeometry"; + + TemporalAContainsTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAContainsTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..7954d1e7ba --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-contains between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acontains_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAContainsTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAContainsTNpointTNpoint"; + + TemporalAContainsTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAContainsTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..5549006050 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-contains between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acontains_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAContainsTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAContainsTPoseGeometry"; + + TemporalAContainsTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAContainsTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..0d3be51f5d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAContainsTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-contains between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acontains_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAContainsTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAContainsTPoseTPose"; + + TemporalAContainsTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalACoversTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalACoversTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..b31942cd4c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalACoversTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event a-covers between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acovers_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalACoversTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalACoversTCbufferCbuffer"; + + TemporalACoversTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalACoversTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalACoversTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..049120245b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalACoversTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-covers between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `acovers_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalACoversTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalACoversTCbuffer"; + + TemporalACoversTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..3c86fa2235 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-distance-within between a single-instant tgeompoint and a static geometry under a static threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinGeometry"; + + TemporalADWithinGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..7988b574d8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-distance-within between a single-instant tcbuffer and a static Cbuffer under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinTCbufferCbuffer"; + + TemporalADWithinTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..b0b66abcf2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-distance-within between a single-instant tcbuffer and a static geometry under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinTCbufferGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinTCbufferGeometry"; + + TemporalADWithinTCbufferGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..fb614afa7e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-distance-within between two single-instant tcbuffers under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinTCbufferTCbuffer"; + + TemporalADWithinTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..2b4fa97a65 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTGeometryLogicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-distance-within between two single-instant tgeompoints under a static threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinTGeometry"; + + TemporalADWithinTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..dbe634f896 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-dwithin between a tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID), within a distance. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinTNpointGeometry"; + + TemporalADWithinTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..7cc8f8b538 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-dwithin between two tgeompoints resolved from tnpoints via tnpoint_to_tgeompoint, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinTNpointTNpoint"; + + TemporalADWithinTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..f265af2fb2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-dwithin between a tgeompoint resolved from a tpose (x,y,theta,ts) via tpose_to_tpoint and a static geometry, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinTPoseGeometry"; + + TemporalADWithinTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADWithinTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..004d256ce5 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADWithinTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-dwithin between two tgeompoints resolved from tposes via tpose_to_tpoint, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adwithin_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADWithinTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADWithinTPoseTPose"; + + TemporalADWithinTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..c0cd1f10af --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-disjoint between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointGeometry"; + + TemporalADisjointGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..b8b99390c2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event a-disjoint between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointTCbufferCbuffer"; + + TemporalADisjointTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..15f38ab811 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-disjoint between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointTCbuffer"; + + TemporalADisjointTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..3878738bdb --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-disjoint between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointTCbufferTCbuffer"; + + TemporalADisjointTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..9c4bd41719 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-disjoint between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointTGeometry"; + + TemporalADisjointTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..3f7e16f0dd --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-disjoint between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointTNpointGeometry"; + + TemporalADisjointTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..e1fbe4311c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-disjoint between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointTNpointTNpoint"; + + TemporalADisjointTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..60ff7aa1fa --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-disjoint between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointTPoseGeometry"; + + TemporalADisjointTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalADisjointTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..ddb1392b4c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalADisjointTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-disjoint between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `adisjoint_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalADisjointTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalADisjointTPoseTPose"; + + TemporalADisjointTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..5f594a8994 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event a-intersects between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `aintersects_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAIntersectsTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAIntersectsTCbufferCbuffer"; + + TemporalAIntersectsTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..84c421ccb7 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-intersects between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `aintersects_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAIntersectsTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAIntersectsTCbuffer"; + + TemporalAIntersectsTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..0336ab9814 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-intersects between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `aintersects_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAIntersectsTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAIntersectsTCbufferTCbuffer"; + + TemporalAIntersectsTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..d8b516893f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-intersects between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `aintersects_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAIntersectsTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAIntersectsTGeometry"; + + TemporalAIntersectsTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..5ccd1fba4e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-intersects between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `aintersects_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAIntersectsTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAIntersectsTNpointGeometry"; + + TemporalAIntersectsTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..8df5eaff52 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-intersects between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `aintersects_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAIntersectsTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAIntersectsTNpointTNpoint"; + + TemporalAIntersectsTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..f0090c8dcb --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-intersects between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `aintersects_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAIntersectsTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAIntersectsTPoseGeometry"; + + TemporalAIntersectsTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..d1daf8fee2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAIntersectsTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-intersects between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `aintersects_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAIntersectsTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAIntersectsTPoseTPose"; + + TemporalAIntersectsTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..e09b1b451c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-touches between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesGeometry"; + + TemporalATouchesGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..5fec7b4429 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event a-touches between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesTCbufferCbuffer"; + + TemporalATouchesTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..60f184df97 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-touches between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesTCbuffer"; + + TemporalATouchesTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..d16ae69b45 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-touches between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesTCbufferTCbuffer"; + + TemporalATouchesTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..3add11b95e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-touches between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesTGeometry"; + + TemporalATouchesTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..e8df1927b3 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-touches between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesTNpointGeometry"; + + TemporalATouchesTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..43e2799ce2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-touches between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesTNpointTNpoint"; + + TemporalATouchesTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..89c52948f4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-touches between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesTPoseGeometry"; + + TemporalATouchesTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalATouchesTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..859b8a2620 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalATouchesTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event always-touches between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `atouches_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalATouchesTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalATouchesTPoseTPose"; + + TemporalATouchesTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalAtGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalAtGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..7ee01fee21 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalAtGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event spatial restriction: 1 if the single-instant tgeompoint survives clipping by the static geometry, 0 if clipped. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tgeo_at_geom`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalAtGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalAtGeometry"; + + TemporalAtGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalCmpLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalCmpLogicalFunction.hpp new file mode 100644 index 0000000000..22f9055469 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalCmpLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_cmp between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_cmp`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalCmpLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalCmp"; + + TemporalCmpLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalDyntimewarpDistanceLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalDyntimewarpDistanceLogicalFunction.hpp new file mode 100644 index 0000000000..2c535dcbff --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalDyntimewarpDistanceLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_dyntimewarp_distance between two single-instant tgeompoints -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_dyntimewarp_distance`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalDyntimewarpDistanceLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalDyntimewarpDistance"; + + TemporalDyntimewarpDistanceLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEContainsTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..13e3ef68b1 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event e-contains between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `econtains_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEContainsTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEContainsTCbufferCbuffer"; + + TemporalEContainsTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEContainsTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..ffe92fd484 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-contains between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `econtains_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEContainsTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEContainsTCbuffer"; + + TemporalEContainsTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEContainsTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..1b4d6c68ae --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-contains between two single-instant tgeompoints built from event fields. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `econtains_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEContainsTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEContainsTGeometry"; + + TemporalEContainsTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEContainsTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..dcb7df1d40 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-contains between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `econtains_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEContainsTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEContainsTNpointGeometry"; + + TemporalEContainsTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEContainsTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..88fdcb7b38 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-contains between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `econtains_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEContainsTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEContainsTNpointTNpoint"; + + TemporalEContainsTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEContainsTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..73aa69109d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-contains between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `econtains_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEContainsTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEContainsTPoseGeometry"; + + TemporalEContainsTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEContainsTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..4bbf3dc62e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEContainsTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-contains between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `econtains_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEContainsTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEContainsTPoseTPose"; + + TemporalEContainsTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..790cf4c60a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-covers between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversGeometry"; + + TemporalECoversGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..78f0758734 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event e-covers between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversTCbufferCbuffer"; + + TemporalECoversTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..2ad42ed992 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-covers between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversTCbuffer"; + + TemporalECoversTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..a94bb794ad --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-covers between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversTCbufferTCbuffer"; + + TemporalECoversTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..2b3ae2ad52 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-covers between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversTGeometry"; + + TemporalECoversTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..af7d68f77a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-covers between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversTNpointGeometry"; + + TemporalECoversTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..e335da1314 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-covers between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversTNpointTNpoint"; + + TemporalECoversTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..977c14e7d7 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-covers between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversTPoseGeometry"; + + TemporalECoversTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalECoversTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalECoversTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..08e315d7fc --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalECoversTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-covers between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `ecovers_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalECoversTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalECoversTPoseTPose"; + + TemporalECoversTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..dfd5c6af39 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-distance-within between a single-instant tcbuffer and a static Cbuffer under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edwithin_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDWithinTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDWithinTCbufferCbuffer"; + + TemporalEDWithinTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..c71ab578a8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-distance-within between a single-instant tcbuffer and a static geometry under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edwithin_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDWithinTCbufferGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDWithinTCbufferGeometry"; + + TemporalEDWithinTCbufferGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..0d61f30c9e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-distance-within between two single-instant tcbuffers under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edwithin_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDWithinTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDWithinTCbufferTCbuffer"; + + TemporalEDWithinTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..c11bae445a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTGeometryLogicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-distance-within between two single-instant tgeompoints under a static threshold. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edwithin_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDWithinTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDWithinTGeometry"; + + TemporalEDWithinTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..803f86cbe9 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-dwithin between a tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID), within a distance. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edwithin_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDWithinTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDWithinTNpointGeometry"; + + TemporalEDWithinTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..33a2113923 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-dwithin between two tgeompoints resolved from tnpoints via tnpoint_to_tgeompoint, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edwithin_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDWithinTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDWithinTNpointTNpoint"; + + TemporalEDWithinTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..7e37e0c89e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-dwithin between a tgeompoint resolved from a tpose (x,y,theta,ts) via tpose_to_tpoint and a static geometry, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edwithin_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDWithinTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDWithinTPoseGeometry"; + + TemporalEDWithinTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..9bfc552331 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDWithinTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-dwithin between two tgeompoints resolved from tposes via tpose_to_tpoint, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edwithin_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDWithinTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDWithinTPoseTPose"; + + TemporalEDWithinTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB, + LogicalFunction dist); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDisjointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..4f2f5b5fce --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-disjoint between a single-instant tgeompoint built from event fields and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edisjoint_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDisjointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDisjointGeometry"; + + TemporalEDisjointGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..173896af8c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event e-disjoint between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edisjoint_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDisjointTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDisjointTCbufferCbuffer"; + + TemporalEDisjointTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..35ea8a1620 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-disjoint between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edisjoint_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDisjointTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDisjointTCbuffer"; + + TemporalEDisjointTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..8120f3f4e0 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-disjoint between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edisjoint_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDisjointTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDisjointTGeometry"; + + TemporalEDisjointTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..b7f729fb1f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-disjoint between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edisjoint_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDisjointTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDisjointTNpointGeometry"; + + TemporalEDisjointTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..71d133db39 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-disjoint between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edisjoint_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDisjointTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDisjointTNpointTNpoint"; + + TemporalEDisjointTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..730141ed5a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-disjoint between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edisjoint_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDisjointTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDisjointTPoseGeometry"; + + TemporalEDisjointTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..143a9c1d87 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEDisjointTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-disjoint between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `edisjoint_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEDisjointTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEDisjointTPoseTPose"; + + TemporalEDisjointTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..f1dc79267b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-intersects between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsGeometry"; + + TemporalEIntersectsGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..af40b6f91b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event e-intersects between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsTCbufferCbuffer"; + + TemporalEIntersectsTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..95018248ea --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-intersects between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsTCbuffer"; + + TemporalEIntersectsTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..bc05a7a5e9 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-intersects between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsTCbufferTCbuffer"; + + TemporalEIntersectsTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..e17c6b0bd6 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-intersects between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsTGeometry"; + + TemporalEIntersectsTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..7864a70d67 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-intersects between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsTNpointGeometry"; + + TemporalEIntersectsTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..6f6c83b43c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-intersects between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsTNpointTNpoint"; + + TemporalEIntersectsTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..b4c52c3ccd --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-intersects between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsTPoseGeometry"; + + TemporalEIntersectsTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..9e2616bbb8 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEIntersectsTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-intersects between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `eintersects_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEIntersectsTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEIntersectsTPoseTPose"; + + TemporalEIntersectsTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..b4de81e708 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-touches between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesGeometry"; + + TemporalETouchesGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..38a7780533 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event e-touches between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesTCbufferCbuffer"; + + TemporalETouchesTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..10a92cf799 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-touches between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesTCbuffer"; + + TemporalETouchesTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..2d98ec176e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-touches between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesTCbufferTCbuffer"; + + TemporalETouchesTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..5eb6e97c27 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-touches between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesTGeometry"; + + TemporalETouchesTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..0f01748aa0 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-touches between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesTNpointGeometry"; + + TemporalETouchesTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..e23a751a6c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-touches between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesTNpointTNpoint"; + + TemporalETouchesTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..02fdd23fd4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-touches between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesTPoseGeometry"; + + TemporalETouchesTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalETouchesTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..9baa5a9f0a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalETouchesTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event ever-touches between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `etouches_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalETouchesTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalETouchesTPoseTPose"; + + TemporalETouchesTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalEqLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalEqLogicalFunction.hpp new file mode 100644 index 0000000000..35223005be --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalEqLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_eq between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_eq`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalEqLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalEq"; + + TemporalEqLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalFrechetDistanceLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalFrechetDistanceLogicalFunction.hpp new file mode 100644 index 0000000000..500e3b6d58 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalFrechetDistanceLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_frechet_distance between two single-instant tgeompoints -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_frechet_distance`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalFrechetDistanceLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalFrechetDistance"; + + TemporalFrechetDistanceLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalGeLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalGeLogicalFunction.hpp new file mode 100644 index 0000000000..6833b70958 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalGeLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_ge between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_ge`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalGeLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalGe"; + + TemporalGeLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalGtLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalGtLogicalFunction.hpp new file mode 100644 index 0000000000..f5f86d35d9 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalGtLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_gt between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_gt`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalGtLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalGt"; + + TemporalGtLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalHausdorffDistanceLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalHausdorffDistanceLogicalFunction.hpp new file mode 100644 index 0000000000..b7f8035d18 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalHausdorffDistanceLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_hausdorff_distance between two single-instant tgeompoints -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_hausdorff_distance`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalHausdorffDistanceLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalHausdorffDistance"; + + TemporalHausdorffDistanceLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalLeLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalLeLogicalFunction.hpp new file mode 100644 index 0000000000..d87329494b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalLeLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_le between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_le`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalLeLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalLe"; + + TemporalLeLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalLtLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalLtLogicalFunction.hpp new file mode 100644 index 0000000000..2b033ffe65 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalLtLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_lt between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_lt`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalLtLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalLt"; + + TemporalLtLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalMinusGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalMinusGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..9b6a9dac3c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalMinusGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event spatial subtraction: 1 if the single-instant tgeompoint survives subtraction of the static geometry, 0 if removed. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tgeo_minus_geom`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalMinusGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalMinusGeometry"; + + TemporalMinusGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADFloatScalarLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADFloatScalarLogicalFunction.hpp new file mode 100644 index 0000000000..a27098d8aa --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADFloatScalarLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between a single-instant tfloat and a scalar double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tfloat_float`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADFloatScalarLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADFloatScalar"; + + TemporalNADFloatScalarLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..0d07c705f4 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADGeometry"; + + TemporalNADGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADIntScalarLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADIntScalarLogicalFunction.hpp new file mode 100644 index 0000000000..df72137b9d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADIntScalarLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between a single-instant tint and a scalar int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tint_int`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADIntScalarLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADIntScalar"; + + TemporalNADIntScalarLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..8b405b741c --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between a single-instant tcbuffer and a static cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tcbuffer_cbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTCbufferCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTCbufferCbuffer"; + + TemporalNADTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLiteral); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..013970d585 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between a single-instant tcbuffer (lon,lat,radius,ts) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tcbuffer_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTCbuffer"; + + TemporalNADTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferTCbufferLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferTCbufferLogicalFunction.hpp new file mode 100644 index 0000000000..9c067080a1 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTCbufferTCbufferLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tcbuffer_tcbuffer`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTCbufferTCbufferLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTCbufferTCbuffer"; + + TemporalNADTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTFloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTFloatLogicalFunction.hpp new file mode 100644 index 0000000000..c64dc6d755 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTFloatLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between two single-instant tfloats. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tfloat_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTFloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTFloat"; + + TemporalNADTFloatLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..1e8991e419 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTGeometryLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTGeometry"; + + TemporalNADTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTIntLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTIntLogicalFunction.hpp new file mode 100644 index 0000000000..88d5d68e7e --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTIntLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between two single-instant tints. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tint_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTIntLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTInt"; + + TemporalNADTIntLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTNpointGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTNpointGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..d5308c88c2 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTNpointGeometryLogicalFunction.hpp @@ -0,0 +1,55 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTNpointGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTNpointGeometry"; + + TemporalNADTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTNpointTNpointLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTNpointTNpointLogicalFunction.hpp new file mode 100644 index 0000000000..60dd0b0305 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTNpointTNpointLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between two single-instant tgeompoints, each resolved from a tnpoint via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTNpointTNpointLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTNpointTNpoint"; + + TemporalNADTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTPoseGeometryLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTPoseGeometryLogicalFunction.hpp new file mode 100644 index 0000000000..e3ffe04e3d --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTPoseGeometryLogicalFunction.hpp @@ -0,0 +1,56 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between a single-instant tgeompoint resolved from a tpose (x,y,theta,ts) via tpose_to_tpoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tgeo_geo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTPoseGeometryLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTPoseGeometry"; + + TemporalNADTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNADTPoseTPoseLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNADTPoseTPoseLogicalFunction.hpp new file mode 100644 index 0000000000..0ea97ff7b1 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNADTPoseTPoseLogicalFunction.hpp @@ -0,0 +1,59 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event nearest-approach distance between two single-instant tgeompoints, each resolved from a tpose via tpose_to_tpoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `nad_tgeo_tgeo`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNADTPoseTPoseLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNADTPoseTPose"; + + TemporalNADTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TemporalNeLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TemporalNeLogicalFunction.hpp new file mode 100644 index 0000000000..ce73f7639f --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TemporalNeLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event temporal_ne between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `temporal_ne`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TemporalNeLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TemporalNe"; + + TemporalNeLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TfloatCeilLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TfloatCeilLogicalFunction.hpp new file mode 100644 index 0000000000..e731cb516a --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TfloatCeilLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tfloat_ceil: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tfloat_ceil`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TfloatCeilLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TfloatCeil"; + + TfloatCeilLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TfloatExpLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TfloatExpLogicalFunction.hpp new file mode 100644 index 0000000000..a006015a7b --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TfloatExpLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tfloat_exp: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tfloat_exp`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TfloatExpLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TfloatExp"; + + TfloatExpLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TfloatFloorLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TfloatFloorLogicalFunction.hpp new file mode 100644 index 0000000000..8734d8a205 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TfloatFloorLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tfloat_floor: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tfloat_floor`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TfloatFloorLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TfloatFloor"; + + TfloatFloorLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TfloatLnLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TfloatLnLogicalFunction.hpp new file mode 100644 index 0000000000..2924cce5ff --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TfloatLnLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tfloat_ln: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tfloat_ln`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TfloatLnLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TfloatLn"; + + TfloatLnLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TfloatLog10LogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TfloatLog10LogicalFunction.hpp new file mode 100644 index 0000000000..0b3703d878 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TfloatLog10LogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tfloat_log10: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tfloat_log10`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TfloatLog10LogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TfloatLog10"; + + TfloatLog10LogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TfloatRadiansLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TfloatRadiansLogicalFunction.hpp new file mode 100644 index 0000000000..cc5271f409 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TfloatRadiansLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tfloat_radians: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tfloat_radians`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TfloatRadiansLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TfloatRadians"; + + TfloatRadiansLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TfloatToTintLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TfloatToTintLogicalFunction.hpp new file mode 100644 index 0000000000..b595ceb478 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TfloatToTintLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tfloat_to_tint: single-instant tfloat transform, value extracted -> int. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tfloat_to_tint`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TfloatToTintLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TfloatToTint"; + + TfloatToTintLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TintToTfloatLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TintToTfloatLogicalFunction.hpp new file mode 100644 index 0000000000..623e82bd44 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TintToTfloatLogicalFunction.hpp @@ -0,0 +1,53 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tint_to_tfloat: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tint_to_tfloat`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TintToTfloatLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TintToTfloat"; + + TintToTfloatLogicalFunction(LogicalFunction value, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TnpointLengthLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TnpointLengthLogicalFunction.hpp new file mode 100644 index 0000000000..b04202e6b7 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TnpointLengthLogicalFunction.hpp @@ -0,0 +1,54 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Per-event tnpoint_length: double accessor over a single-instant tnpoint. + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tnpoint_length`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TnpointLengthLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TnpointLength"; + + TnpointLengthLogicalFunction(LogicalFunction rid, + LogicalFunction frac, + LogicalFunction ts); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Functions/Meos/TpointLengthWkbLogicalFunction.hpp b/nes-logical-operators/include/Functions/Meos/TpointLengthWkbLogicalFunction.hpp new file mode 100644 index 0000000000..a1c52da598 --- /dev/null +++ b/nes-logical-operators/include/Functions/Meos/TpointLengthWkbLogicalFunction.hpp @@ -0,0 +1,52 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Function-library-over-MEOS-value: tpoint_length applied to an upstream hex-WKB trajectory value (the efficient compose-on-materialized-trajectory mechanism). + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `tpoint_length`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class TpointLengthWkbLogicalFunction : public LogicalFunctionConcept { +public: + static constexpr std::string_view NAME = "TpointLengthWkb"; + + TpointLengthWkbLogicalFunction(LogicalFunction traj); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}; + +} // namespace NES diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/BigintExtentAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/BigintExtentAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..2929b1edcd --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/BigintExtentAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed value extent (BIGINTSPAN) over a tbigint stream via bigint_extent_transfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class BigintExtentAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + BigintExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~BigintExtentAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "BigintExtent"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/BigintUnionAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/BigintUnionAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..c84788f60d --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/BigintUnionAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed value union (BIGINTSET) over a tbigint stream via bigint_union_transfn + set_union_finalfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class BigintUnionAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + BigintUnionAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~BigintUnionAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "BigintUnion"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/CrossDistanceAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/CrossDistanceAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..7d5cfae0a2 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/CrossDistanceAggregationLogicalFunction.hpp @@ -0,0 +1,89 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include + +namespace NES +{ + +/** + * @brief Logical-plan side of the CROSS_DISTANCE aggregation (BerlinMOD-Q9). + * + * Four input fields (lon, lat, timestamp, vehicle_id) + per-aggregation `(vidA, vidB)` + * target-vehicle pair (the two integer constants identifying which vehicles to compute + * the distance between). Final aggregate stamp = FLOAT64 (spheroidal distance in metres + * between the two vehicles' latest known positions in the window; NaN if either is + * unobserved). See `CrossDistanceAggregationPhysicalFunction`. + * + * @note The Registrar deserialize path receives only the 5 field args (lon, lat, ts, + * vid, asField) and reconstructs the aggregation with the `DEFAULT_VID_A` / + * `DEFAULT_VID_B` constants. Round-trip Serde fidelity for the vidA/vidB values is a + * follow-up; mirrors PairMeeting #19's same Serde caveat (the proto carries only + * SerializableFunction-typed fields in `extra_fields`). + */ +class CrossDistanceAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + /// BerlinMOD-scaffold defaults; mirror `CrossDistanceAggregationPhysicalFunction`. + /// Used by the Registrar deserialize path; the parser path always supplies + /// explicit values. + static constexpr uint64_t DEFAULT_VID_A = 100; + static constexpr uint64_t DEFAULT_VID_B = 200; + + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& vehicleIdField, + uint64_t vidA, + uint64_t vidB); + + CrossDistanceAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& vehicleIdField, + const FieldAccessLogicalFunction& asField, + uint64_t vidA, + uint64_t vidB); + + void inferStamp(const Schema& schema) override; + ~CrossDistanceAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + [[nodiscard]] const FieldAccessLogicalFunction& getVehicleIdField() const noexcept { return vehicleIdField; } + [[nodiscard]] uint64_t getVidA() const noexcept { return vidA; } + [[nodiscard]] uint64_t getVidB() const noexcept { return vidB; } + +private: + static constexpr std::string_view NAME = "CrossDistance"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; + FieldAccessLogicalFunction vehicleIdField; + uint64_t vidA; + uint64_t vidB; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/FloatExtentAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/FloatExtentAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..3b3bfd1ccb --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/FloatExtentAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed value extent (FLOATSPAN) over a tfloat stream via float_extent_transfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class FloatExtentAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + FloatExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~FloatExtentAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "FloatExtent"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/FloatUnionAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/FloatUnionAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..5c18e62277 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/FloatUnionAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed value union (FLOATSET) over a tfloat stream via float_union_transfn + set_union_finalfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class FloatUnionAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + FloatUnionAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~FloatUnionAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "FloatUnion"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/IntExtentAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/IntExtentAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..7b0192d1d4 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/IntExtentAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed value extent (INTSPAN) over a tint stream via int_extent_transfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class IntExtentAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + IntExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~IntExtentAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "IntExtent"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/IntUnionAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/IntUnionAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..2c9b38c51d --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/IntUnionAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed value union (INTSET) over a tint stream via int_union_transfn + set_union_finalfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class IntUnionAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + IntUnionAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~IntUnionAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "IntUnion"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/PairMeetingAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/PairMeetingAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..bd08ee96cd --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/PairMeetingAggregationLogicalFunction.hpp @@ -0,0 +1,83 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Logical-plan side of the PAIR_MEETING aggregation (BerlinMOD-Q5). + * + * Four input fields (lon, lat, timestamp, vehicle_id) + per-aggregation + * `dMeetMetres` constant (the meeting-distance threshold, e.g. 200.0 in the + * BerlinMOD scaffold). Final aggregate stamp = VARSIZED (string-encoded list of + * meeting pairs). See `PairMeetingAggregationPhysicalFunction` for the + * lift / combine / lower path. + * + * @note The Registrar deserialize path receives only the 5 field args (lon, lat, + * ts, vid, asField) and reconstructs the aggregation with the + * `DEFAULT_DMEET_METRES` constant. Round-trip Serde fidelity for the dMeet + * value is a follow-up — it requires adding a new field to + * `SerializableAggregationFunction` (the proto currently carries only + * SerializableFunction-typed fields in `extra_fields`). + */ +class PairMeetingAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + /// BerlinMOD-scaffold default; mirrors `PairMeetingAggregationPhysicalFunction::DEFAULT_DMEET_METRES`. + /// Used by the Registrar deserialize path; the parser path always supplies an explicit value. + static constexpr double DEFAULT_DMEET_METRES = 200.0; + + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& vehicleIdField, + double dMeetMetres); + + PairMeetingAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& vehicleIdField, + const FieldAccessLogicalFunction& asField, + double dMeetMetres); + + void inferStamp(const Schema& schema) override; + ~PairMeetingAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + [[nodiscard]] const FieldAccessLogicalFunction& getVehicleIdField() const noexcept { return vehicleIdField; } + [[nodiscard]] double getDMeetMetres() const noexcept { return dMeetMetres; } + +private: + static constexpr std::string_view NAME = "PairMeeting"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; + FieldAccessLogicalFunction vehicleIdField; + double dMeetMetres; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TLengthExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TLengthExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..5add8d3cb4 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TLengthExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed trajectory length over an expandable Temporal* grown by appendInstant — the MEOS-native streaming aggregation (no string build, no WKB). + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_length` to fold it to a single scalar. + */ +class TLengthExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TLengthExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TLengthExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TLengthExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalAtMaxExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalAtMaxExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..6a0519372c --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalAtMaxExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed temporal_at_max over the expandable tfloat mini-series, emitted as hex-WKB. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `temporal_at_max` to fold it to a single scalar. + */ +class TemporalAtMaxExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalAtMaxExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalAtMaxExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalAtMaxExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalAtMinExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalAtMinExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..38129b38cb --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalAtMinExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed temporal_at_min over the expandable tfloat mini-series, emitted as hex-WKB. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `temporal_at_min` to fold it to a single scalar. + */ +class TemporalAtMinExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalAtMinExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalAtMinExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalAtMinExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalCopyExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalCopyExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..d0305627e1 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalCopyExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed temporal_copy over the expandable mini-trip, emitted as hex-WKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `temporal_copy` to fold it to a single scalar. + */ +class TemporalCopyExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalCopyExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalCopyExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalCopyExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalDerivativeExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalDerivativeExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..3a25c1ecf1 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalDerivativeExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed temporal_derivative over the expandable tfloat mini-series, emitted as hex-WKB. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `temporal_derivative` to fold it to a single scalar. + */ +class TemporalDerivativeExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalDerivativeExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalDerivativeExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalDerivativeExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalEndTimestampAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalEndTimestampAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..4a96356da5 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalEndTimestampAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief TimestampTz (MEOS μs-since-2000) of the last instant in the per-(window, group) tgeo trajectory. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `temporal_end_timestamptz` to fold it to a single scalar. + */ +class TemporalEndTimestampAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalEndTimestampAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalEndTimestampAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalEndTimestamp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT64; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalLengthAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalLengthAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..b2225f7240 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalLengthAggregationLogicalFunction.hpp @@ -0,0 +1,64 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Logical-plan side of the TEMPORAL_LENGTH aggregation. + * + * Takes three input fields (longitude, latitude, timestamp) and produces a + * single FLOAT64 result: the spheroidal length in metres of the per-(window, + * group) trajectory built from the lifted tuples. + * + * Same shape as TemporalSequenceAggregationLogicalFunctionV2; only the final + * aggregate stamp type differs (FLOAT64 here vs VARSIZED there). Closes the + * MobilityNebula BerlinMOD-Q6 partial→full gap. + */ +class TemporalLengthAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalLengthAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalLengthAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalLength"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalLowerIncAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalLowerIncAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..a989d2b98c --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalLowerIncAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief True if the per-(window, group) tgeo trajectory's lower period bound is inclusive. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `temporal_lower_inc` to fold it to a single scalar. + */ +class TemporalLowerIncAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalLowerIncAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalLowerIncAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalLowerInc"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::BOOLEAN; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalMinusMaxExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalMinusMaxExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..c0ebdb3e7b --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalMinusMaxExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed temporal_minus_max over the expandable tfloat mini-series, emitted as hex-WKB. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `temporal_minus_max` to fold it to a single scalar. + */ +class TemporalMinusMaxExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalMinusMaxExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalMinusMaxExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalMinusMaxExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalMinusMinExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalMinusMinExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..559c8589cb --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalMinusMinExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed temporal_minus_min over the expandable tfloat mini-series, emitted as hex-WKB. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `temporal_minus_min` to fold it to a single scalar. + */ +class TemporalMinusMinExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalMinusMinExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalMinusMinExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalMinusMinExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumInstantsAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumInstantsAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..38bf81b966 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumInstantsAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Per-(window, group) count of instants in the assembled tgeo trajectory. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `temporal_num_instants` to fold it to a single scalar. + */ +class TemporalNumInstantsAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalNumInstantsAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalNumInstantsAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalNumInstants"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT32; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumSequencesAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumSequencesAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..bdf1f5841d --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumSequencesAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Per-(window, group) count of sub-sequences in the assembled tgeo trajectory. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `temporal_num_sequences` to fold it to a single scalar. + */ +class TemporalNumSequencesAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalNumSequencesAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalNumSequencesAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalNumSequences"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT32; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumTimestampsAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumTimestampsAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..9bce42486c --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalNumTimestampsAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Per-(window, group) count of distinct timestamps in the assembled tgeo trajectory. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `temporal_num_timestamps` to fold it to a single scalar. + */ +class TemporalNumTimestampsAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalNumTimestampsAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalNumTimestampsAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalNumTimestamps"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT32; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalStartTimestampAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalStartTimestampAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..bb4f329ba1 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalStartTimestampAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief TimestampTz (MEOS μs-since-2000) of the first instant in the per-(window, group) tgeo trajectory. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `temporal_start_timestamptz` to fold it to a single scalar. + */ +class TemporalStartTimestampAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalStartTimestampAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalStartTimestampAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalStartTimestamp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT64; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatAvgValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatAvgValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..7ccfcf08cf --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatAvgValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Arithmetic mean of all instant values in the per-(window, group) tfloat sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tfloat_avg_value` to fold it to a single scalar. + */ +class TemporalTFloatAvgValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTFloatAvgValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTFloatAvgValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTFloatAvgValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatEndValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatEndValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..0ae6b94884 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatEndValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Value at the last instant of the per-(window, group) tfloat sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tfloat_end_value` to fold it to a single scalar. + */ +class TemporalTFloatEndValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTFloatEndValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTFloatEndValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTFloatEndValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatMaxValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatMaxValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..89d95846f3 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatMaxValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Maximum value across instants of the per-(window, group) tfloat sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tfloat_max_value` to fold it to a single scalar. + */ +class TemporalTFloatMaxValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTFloatMaxValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTFloatMaxValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTFloatMaxValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatMinValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatMinValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..7dff67a09c --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatMinValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Minimum value across instants of the per-(window, group) tfloat sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tfloat_min_value` to fold it to a single scalar. + */ +class TemporalTFloatMinValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTFloatMinValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTFloatMinValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTFloatMinValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatStartValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatStartValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..c297491191 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTFloatStartValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Value at the first instant of the per-(window, group) tfloat sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tfloat_start_value` to fold it to a single scalar. + */ +class TemporalTFloatStartValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTFloatStartValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTFloatStartValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTFloatStartValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntAvgValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntAvgValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..4843237715 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntAvgValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Arithmetic mean (as double) of all instant values in the per-(window, group) tint sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tnumber_avg_value` to fold it to a single scalar. + */ +class TemporalTIntAvgValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTIntAvgValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTIntAvgValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTIntAvgValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntEndValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntEndValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..9334823987 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntEndValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Value at the last instant of the per-(window, group) tint sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tint_end_value` to fold it to a single scalar. + */ +class TemporalTIntEndValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTIntEndValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTIntEndValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTIntEndValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT32; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntMaxValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntMaxValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..0864562b80 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntMaxValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Maximum value across instants of the per-(window, group) tint sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tint_max_value` to fold it to a single scalar. + */ +class TemporalTIntMaxValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTIntMaxValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTIntMaxValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTIntMaxValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT32; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntMinValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntMinValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..49756e9127 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntMinValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Minimum value across instants of the per-(window, group) tint sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tint_min_value` to fold it to a single scalar. + */ +class TemporalTIntMinValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTIntMinValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTIntMinValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTIntMinValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT32; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntStartValueAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntStartValueAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..686b062cce --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTIntStartValueAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Value at the first instant of the per-(window, group) tint sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tint_start_value` to fold it to a single scalar. + */ +class TemporalTIntStartValueAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTIntStartValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTIntStartValueAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTIntStartValue"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::INT32; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTNumberIntegralAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTNumberIntegralAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..f536962786 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTNumberIntegralAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Time-weighted integral (area under the value-vs-time curve) of the per-(window, group) tfloat sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tnumber_integral` to fold it to a single scalar. + */ +class TemporalTNumberIntegralAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTNumberIntegralAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTNumberIntegralAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTNumberIntegral"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTNumberTwAvgAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTNumberTwAvgAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..2b5c6aa3e7 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTNumberTwAvgAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Time-weighted average of values across the per-(window, group) tfloat sequence. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tnumber_twavg` to fold it to a single scalar. + */ +class TemporalTNumberTwAvgAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TemporalTNumberTwAvgAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTNumberTwAvgAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTNumberTwAvg"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::FLOAT64; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTPointIsSimpleAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTPointIsSimpleAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..07be63f5ff --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalTPointIsSimpleAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief True if the per-(window, group) tgeo trajectory does not self-intersect. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_is_simple` to fold it to a single scalar. + */ +class TemporalTPointIsSimpleAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalTPointIsSimpleAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalTPointIsSimpleAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalTPointIsSimple"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::BOOLEAN; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalUpperIncAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalUpperIncAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..e1ccea7b47 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TemporalUpperIncAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief True if the per-(window, group) tgeo trajectory's upper period bound is inclusive. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `temporal_upper_inc` to fold it to a single scalar. + */ +class TemporalUpperIncAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TemporalUpperIncAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TemporalUpperIncAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TemporalUpperInc"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::BOOLEAN; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoCentroidExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoCentroidExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..391a90c9a6 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoCentroidExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed centroid trajectory via tgeo_centroid over the expandable mini-trip, emitted as hex-WKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tgeo_centroid` to fold it to a single scalar. + */ +class TgeoCentroidExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TgeoCentroidExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TgeoCentroidExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TgeoCentroidExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoConvexHullExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoConvexHullExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..7fc3442ce8 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoConvexHullExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint mini-trip; tgeo_convex_hull emits the trajectory convex hull as hex-EWKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tgeo_convex_hull` to fold it to a single scalar. + */ +class TgeoConvexHullExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TgeoConvexHullExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TgeoConvexHullExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TgeoConvexHullExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoEndValueExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoEndValueExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..fdb143ff71 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoEndValueExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint mini-trip; tgeo_end_value emits the last point geometry as hex-EWKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tgeo_end_value` to fold it to a single scalar. + */ +class TgeoEndValueExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TgeoEndValueExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TgeoEndValueExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TgeoEndValueExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoStartValueExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoStartValueExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..75ebfd1599 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeoStartValueExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint mini-trip; tgeo_start_value emits the first point geometry as hex-EWKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tgeo_start_value` to fold it to a single scalar. + */ +class TgeoStartValueExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TgeoStartValueExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TgeoStartValueExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TgeoStartValueExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeompointToTgeometryExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeompointToTgeometryExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..d9ebcf97ef --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TgeompointToTgeometryExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint->tgeometry conversion over the expandable mini-trip, emitted as hex-WKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tgeompoint_to_tgeometry` to fold it to a single scalar. + */ +class TgeompointToTgeometryExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TgeompointToTgeometryExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TgeompointToTgeometryExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TgeompointToTgeometryExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TimestamptzExtentAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TimestamptzExtentAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..faaa6d165c --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TimestamptzExtentAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed time extent (TSTZSPAN) over an event-time field via timestamptz_extent_transfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class TimestamptzExtentAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TimestamptzExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TimestamptzExtentAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TimestamptzExtent"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TimestamptzUnionAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TimestamptzUnionAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..ba64670fbf --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TimestamptzUnionAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed time union (TSTZSET) over an event-time field via timestamptz_union_transfn + set_union_finalfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class TimestamptzUnionAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TimestamptzUnionAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TimestamptzUnionAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TimestamptzUnion"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointCumulativeLengthExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointCumulativeLengthExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..a982a2c66c --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointCumulativeLengthExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tnpoint_cumulative_length over the expandable tnpoint mini-series, emitted as hex-WKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tnpoint_cumulative_length` to fold it to a single scalar. + */ +class TnpointCumulativeLengthExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TnpointCumulativeLengthExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TnpointCumulativeLengthExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TnpointCumulativeLengthExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointSpeedExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointSpeedExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..ea05e33b24 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointSpeedExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tnpoint_speed over the expandable tnpoint mini-series, emitted as hex-WKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tnpoint_speed` to fold it to a single scalar. + */ +class TnpointSpeedExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TnpointSpeedExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TnpointSpeedExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TnpointSpeedExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointToTgeompointExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointToTgeompointExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..16bb46ed16 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnpointToTgeompointExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tnpoint_to_tgeompoint over the expandable tnpoint mini-series, emitted as hex-WKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tnpoint_to_tgeompoint` to fold it to a single scalar. + */ +class TnpointToTgeompointExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TnpointToTgeompointExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TnpointToTgeompointExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TnpointToTgeompointExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberAbsExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberAbsExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..d8ee062cc1 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberAbsExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tnumber_abs over the expandable tfloat mini-series, emitted as hex-WKB. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tnumber_abs` to fold it to a single scalar. + */ +class TnumberAbsExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TnumberAbsExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TnumberAbsExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TnumberAbsExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberAngularDifferenceExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberAngularDifferenceExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..29803493cc --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberAngularDifferenceExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tnumber_angular_difference over the expandable tfloat mini-series, emitted as hex-WKB. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tnumber_angular_difference` to fold it to a single scalar. + */ +class TnumberAngularDifferenceExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TnumberAngularDifferenceExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TnumberAngularDifferenceExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TnumberAngularDifferenceExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberDeltaValueExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberDeltaValueExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..d67b40ba9a --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberDeltaValueExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tnumber_delta_value over the expandable tfloat mini-series, emitted as hex-WKB. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tnumber_delta_value` to fold it to a single scalar. + */ +class TnumberDeltaValueExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TnumberDeltaValueExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TnumberDeltaValueExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TnumberDeltaValueExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberExtentAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberExtentAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..fd6e401e5e --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberExtentAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed numeric-temporal extent (TBox) over a tnumber sequence via tnumber_extent_transfn. + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `` to fold it to a single scalar. + */ +class TnumberExtentAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TnumberExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TnumberExtentAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TnumberExtent"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberTrendExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberTrendExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..18fa7049fc --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TnumberTrendExpAggregationLogicalFunction.hpp @@ -0,0 +1,57 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tnumber mini-series; tnumber_trend emits the rising/falling trend as a tint (hex-WKB). + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `tnumber_trend` to fold it to a single scalar. + */ +class TnumberTrendExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + TnumberTrendExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TnumberTrendExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept { return valueField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TnumberTrendExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointAngularDifferenceExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointAngularDifferenceExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..bca1da7585 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointAngularDifferenceExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed angular difference via tpoint_angular_difference over the expandable mini-trip, emitted as hex-WKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_angular_difference` to fold it to a single scalar. + */ +class TpointAngularDifferenceExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TpointAngularDifferenceExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TpointAngularDifferenceExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TpointAngularDifferenceExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointAzimuthExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointAzimuthExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..dd493fd01a --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointAzimuthExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed azimuth (tfloat) via tpoint_azimuth over the expandable mini-trip, emitted as hex-WKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_azimuth` to fold it to a single scalar. + */ +class TpointAzimuthExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TpointAzimuthExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TpointAzimuthExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TpointAzimuthExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointCumulativeLengthExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointCumulativeLengthExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..889b72488c --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointCumulativeLengthExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint mini-trip grown by appendInstant; tpoint_cumulative_length emits the running planar length as a tfloat (hex-WKB). + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_cumulative_length` to fold it to a single scalar. + */ +class TpointCumulativeLengthExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TpointCumulativeLengthExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TpointCumulativeLengthExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TpointCumulativeLengthExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointGetXExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointGetXExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..7fcbb9cb79 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointGetXExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint mini-trip; tpoint_get_x projects the X coordinate as a tfloat (hex-WKB). + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_get_x` to fold it to a single scalar. + */ +class TpointGetXExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TpointGetXExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TpointGetXExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TpointGetXExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointGetYExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointGetYExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..65ca160a17 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointGetYExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint mini-trip; tpoint_get_y projects the Y coordinate as a tfloat (hex-WKB). + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_get_y` to fold it to a single scalar. + */ +class TpointGetYExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TpointGetYExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TpointGetYExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TpointGetYExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointSpeedExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointSpeedExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..9d60230522 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointSpeedExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint mini-trip; tpoint_speed differentiates it into a speed tfloat (hex-WKB). + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_speed` to fold it to a single scalar. + */ +class TpointSpeedExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TpointSpeedExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TpointSpeedExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TpointSpeedExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointTwcentroidExpAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointTwcentroidExpAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..8c8a539ef0 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TpointTwcentroidExpAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed tgeompoint mini-trip; tpoint_twcentroid emits the time-weighted centroid point as hex-EWKB. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `tpoint_twcentroid` to fold it to a single scalar. + */ +class TpointTwcentroidExpAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TpointTwcentroidExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TpointTwcentroidExpAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TpointTwcentroidExp"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TrajectoryWkbAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TrajectoryWkbAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..e8ee400bbb --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TrajectoryWkbAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed mini-trip trajectory materialized as hex-WKB — the value the MEOS function library composes over. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `` to fold it to a single scalar. + */ +class TrajectoryWkbAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TrajectoryWkbAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TrajectoryWkbAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TrajectoryWkb"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TspatialExtentAggregationLogicalFunction.hpp b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TspatialExtentAggregationLogicalFunction.hpp new file mode 100644 index 0000000000..c8c68a6de5 --- /dev/null +++ b/nes-logical-operators/include/Operators/Windows/Aggregations/Meos/TspatialExtentAggregationLogicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{ + +/** + * @brief Windowed spatiotemporal extent (STBox) over a tgeo trajectory via tspatial_extent_transfn. + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `` to fold it to a single scalar. + */ +class TspatialExtentAggregationLogicalFunction : public WindowAggregationLogicalFunction +{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + TspatialExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~TspatialExtentAggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const { return true; } + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept { return lonField; } + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept { return latField; } + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept { return timestampField; } + +private: + static constexpr std::string_view NAME = "TspatialExtent"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::VARSIZED; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}; +} diff --git a/nes-logical-operators/registry/include/AggregationLogicalFunctionRegistry.hpp b/nes-logical-operators/registry/include/AggregationLogicalFunctionRegistry.hpp index 7e1e73e55d..5f881a0498 100644 --- a/nes-logical-operators/registry/include/AggregationLogicalFunctionRegistry.hpp +++ b/nes-logical-operators/registry/include/AggregationLogicalFunctionRegistry.hpp @@ -29,6 +29,9 @@ using AggregationLogicalFunctionRegistryReturnType = std::shared_ptr fields; + /// Query-literal constants for parameterized aggregates (deserialized from + /// SerializableAggregationFunction.literals). Empty for field-only aggregates. + std::vector literals; }; class AggregationLogicalFunctionRegistry : public BaseRegistry< diff --git a/nes-logical-operators/src/Functions/Meos/AboveStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AboveStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..fa77361fcb --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AboveStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AboveStboxStboxLogicalFunction::AboveStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType AboveStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AboveStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AboveStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AboveStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "AboveStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AboveStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool AboveStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AboveStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AboveStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AboveStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAboveStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "AboveStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return AboveStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AboveStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AboveStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..1e281ea75c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AboveStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AboveStboxTspatialLogicalFunction::AboveStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AboveStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AboveStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AboveStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AboveStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AboveStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AboveStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool AboveStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AboveStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AboveStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AboveStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAboveStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AboveStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AboveStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AboveTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AboveTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..b257ba7b3a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AboveTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AboveTspatialStboxLogicalFunction::AboveTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AboveTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AboveTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AboveTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AboveTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AboveTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AboveTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool AboveTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AboveTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AboveTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AboveTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAboveTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AboveTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AboveTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AboveTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AboveTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..0e58f72c8a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AboveTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AboveTspatialTspatialLogicalFunction::AboveTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType AboveTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AboveTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AboveTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AboveTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "AboveTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AboveTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool AboveTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AboveTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AboveTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AboveTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAboveTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "AboveTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return AboveTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AdjacentStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AdjacentStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..8cb832312e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AdjacentStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AdjacentStboxStboxLogicalFunction::AdjacentStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType AdjacentStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AdjacentStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AdjacentStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AdjacentStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "AdjacentStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AdjacentStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool AdjacentStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AdjacentStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AdjacentStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AdjacentStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAdjacentStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "AdjacentStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return AdjacentStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AdjacentStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AdjacentStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..46c3ab9a35 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AdjacentStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AdjacentStboxTspatialLogicalFunction::AdjacentStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AdjacentStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AdjacentStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AdjacentStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AdjacentStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AdjacentStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AdjacentStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool AdjacentStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AdjacentStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AdjacentStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AdjacentStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAdjacentStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AdjacentStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AdjacentStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AdjacentTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AdjacentTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..0b8fb43fc6 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AdjacentTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AdjacentTboxTnumberLogicalFunction::AdjacentTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AdjacentTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AdjacentTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AdjacentTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AdjacentTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AdjacentTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AdjacentTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool AdjacentTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AdjacentTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AdjacentTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AdjacentTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAdjacentTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AdjacentTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AdjacentTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AdjacentTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AdjacentTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..97294d7d7e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AdjacentTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AdjacentTemporalTemporalLogicalFunction::AdjacentTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType AdjacentTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AdjacentTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AdjacentTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AdjacentTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "AdjacentTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AdjacentTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool AdjacentTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AdjacentTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AdjacentTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AdjacentTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAdjacentTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "AdjacentTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return AdjacentTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AdjacentTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AdjacentTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..4127bc607d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AdjacentTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AdjacentTnumberTboxLogicalFunction::AdjacentTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AdjacentTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AdjacentTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AdjacentTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AdjacentTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AdjacentTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AdjacentTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool AdjacentTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AdjacentTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AdjacentTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AdjacentTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAdjacentTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AdjacentTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AdjacentTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AdjacentTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AdjacentTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..4318d3c343 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AdjacentTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AdjacentTnumberTnumberLogicalFunction::AdjacentTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType AdjacentTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AdjacentTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AdjacentTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AdjacentTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "AdjacentTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AdjacentTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool AdjacentTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AdjacentTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AdjacentTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AdjacentTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAdjacentTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "AdjacentTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return AdjacentTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AdjacentTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AdjacentTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..196c3a11a7 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AdjacentTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AdjacentTspatialStboxLogicalFunction::AdjacentTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AdjacentTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AdjacentTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AdjacentTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AdjacentTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AdjacentTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AdjacentTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool AdjacentTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AdjacentTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AdjacentTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AdjacentTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAdjacentTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AdjacentTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AdjacentTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AdjacentTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AdjacentTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..0c615a1465 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AdjacentTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AdjacentTspatialTspatialLogicalFunction::AdjacentTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType AdjacentTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AdjacentTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AdjacentTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AdjacentTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "AdjacentTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AdjacentTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool AdjacentTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AdjacentTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AdjacentTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AdjacentTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAdjacentTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "AdjacentTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return AdjacentTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AfterStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AfterStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..30828a184f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AfterStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AfterStboxStboxLogicalFunction::AfterStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType AfterStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AfterStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AfterStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AfterStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "AfterStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AfterStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool AfterStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AfterStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AfterStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AfterStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAfterStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "AfterStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return AfterStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AfterStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AfterStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..abe1db46b3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AfterStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AfterStboxTspatialLogicalFunction::AfterStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AfterStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AfterStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AfterStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AfterStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AfterStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AfterStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool AfterStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AfterStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AfterStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AfterStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAfterStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AfterStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AfterStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AfterTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AfterTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..27b78aba9b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AfterTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AfterTboxTnumberLogicalFunction::AfterTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AfterTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AfterTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AfterTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AfterTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AfterTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AfterTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool AfterTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AfterTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AfterTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AfterTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAfterTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AfterTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AfterTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AfterTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AfterTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..d6c290cd47 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AfterTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AfterTemporalTemporalLogicalFunction::AfterTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType AfterTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AfterTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AfterTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AfterTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "AfterTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AfterTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool AfterTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AfterTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AfterTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AfterTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAfterTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "AfterTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return AfterTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AfterTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AfterTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..a1238508b6 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AfterTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AfterTnumberTboxLogicalFunction::AfterTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AfterTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AfterTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AfterTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AfterTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AfterTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AfterTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool AfterTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AfterTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AfterTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AfterTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAfterTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AfterTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AfterTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AfterTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AfterTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..45628fda53 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AfterTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AfterTnumberTnumberLogicalFunction::AfterTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType AfterTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AfterTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AfterTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AfterTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "AfterTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AfterTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool AfterTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AfterTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AfterTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AfterTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAfterTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "AfterTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return AfterTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AfterTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AfterTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..0cb9ee12d2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AfterTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AfterTspatialStboxLogicalFunction::AfterTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AfterTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AfterTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AfterTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AfterTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AfterTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AfterTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool AfterTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AfterTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AfterTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AfterTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAfterTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AfterTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AfterTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AfterTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AfterTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..b95f836ad2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AfterTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AfterTspatialTspatialLogicalFunction::AfterTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType AfterTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AfterTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AfterTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AfterTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "AfterTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AfterTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool AfterTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AfterTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AfterTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AfterTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAfterTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "AfterTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return AfterTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..e2bc4125ac --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqFloatTfloatLogicalFunction::AlwaysEqFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysEqFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysEqFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysEqFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysEqFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..4359600efd --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqIntTintLogicalFunction::AlwaysEqIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysEqIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysEqIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysEqIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysEqIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqTboolBoolLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqTboolBoolLogicalFunction.cpp new file mode 100644 index 0000000000..037b094d75 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqTboolBoolLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqTboolBoolLogicalFunction::AlwaysEqTboolBoolLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AlwaysEqTboolBoolLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqTboolBoolLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqTboolBoolLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqTboolBoolLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysEqTboolBoolLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqTboolBoolLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqTboolBoolLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqTboolBoolLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqTboolBoolLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqTboolBoolLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqTboolBoolLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysEqTboolBoolLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysEqTboolBoolLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqTcbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqTcbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..ab89ee0a36 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqTcbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqTcbufferCbufferLogicalFunction::AlwaysEqTcbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbuffer) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbuffer)); +} + +DataType AlwaysEqTcbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqTcbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqTcbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqTcbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "AlwaysEqTcbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqTcbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqTcbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqTcbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqTcbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqTcbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqTcbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "AlwaysEqTcbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return AlwaysEqTcbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqTcbufferTcbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqTcbufferTcbufferLogicalFunction.cpp new file mode 100644 index 0000000000..10ff9ff00d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqTcbufferTcbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqTcbufferTcbufferLogicalFunction::AlwaysEqTcbufferTcbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysEqTcbufferTcbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqTcbufferTcbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqTcbufferTcbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqTcbufferTcbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "AlwaysEqTcbufferTcbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqTcbufferTcbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqTcbufferTcbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqTcbufferTcbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqTcbufferTcbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqTcbufferTcbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqTcbufferTcbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "AlwaysEqTcbufferTcbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return AlwaysEqTcbufferTcbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..ee41f89643 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqTemporalTemporalLogicalFunction::AlwaysEqTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysEqTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AlwaysEqTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AlwaysEqTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AlwaysEqTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..eeea8cf2d7 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqTfloatFloatLogicalFunction::AlwaysEqTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysEqTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysEqTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysEqTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysEqTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqTgeoGeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqTgeoGeoLogicalFunction.cpp new file mode 100644 index 0000000000..5ac92bb901 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqTgeoGeoLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqTgeoGeoLogicalFunction::AlwaysEqTgeoGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType AlwaysEqTgeoGeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqTgeoGeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqTgeoGeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqTgeoGeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AlwaysEqTgeoGeoLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqTgeoGeoLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqTgeoGeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqTgeoGeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqTgeoGeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqTgeoGeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqTgeoGeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AlwaysEqTgeoGeoLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AlwaysEqTgeoGeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqTgeoTgeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqTgeoTgeoLogicalFunction.cpp new file mode 100644 index 0000000000..4784d055ab --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqTgeoTgeoLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqTgeoTgeoLogicalFunction::AlwaysEqTgeoTgeoLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysEqTgeoTgeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqTgeoTgeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqTgeoTgeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqTgeoTgeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "AlwaysEqTgeoTgeoLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqTgeoTgeoLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqTgeoTgeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqTgeoTgeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqTgeoTgeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqTgeoTgeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqTgeoTgeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "AlwaysEqTgeoTgeoLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return AlwaysEqTgeoTgeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysEqTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysEqTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..dfef07bc7d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysEqTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysEqTintIntLogicalFunction::AlwaysEqTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysEqTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysEqTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysEqTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysEqTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysEqTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysEqTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysEqTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysEqTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysEqTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysEqTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysEqTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysEqTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysEqTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGeFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGeFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..b69aa2c8f3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGeFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGeFloatTfloatLogicalFunction::AlwaysGeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysGeFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGeFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGeFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGeFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysGeFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGeFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGeFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGeFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGeFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGeFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGeFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysGeFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysGeFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGeIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGeIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..24a841bb7a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGeIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGeIntTintLogicalFunction::AlwaysGeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysGeIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGeIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGeIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGeIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysGeIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGeIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGeIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGeIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGeIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGeIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGeIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysGeIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysGeIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGeTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGeTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..ca4699050b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGeTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGeTemporalTemporalLogicalFunction::AlwaysGeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysGeTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGeTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGeTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGeTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AlwaysGeTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGeTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGeTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGeTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGeTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGeTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGeTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AlwaysGeTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AlwaysGeTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGeTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGeTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..76cdf683eb --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGeTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGeTfloatFloatLogicalFunction::AlwaysGeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysGeTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGeTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGeTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGeTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysGeTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGeTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGeTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGeTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGeTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGeTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGeTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysGeTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysGeTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGeTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGeTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..5b0eaf8642 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGeTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGeTintIntLogicalFunction::AlwaysGeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysGeTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGeTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGeTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGeTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysGeTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGeTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGeTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGeTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGeTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGeTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGeTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysGeTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysGeTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGtFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGtFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..6b5eded22c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGtFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGtFloatTfloatLogicalFunction::AlwaysGtFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysGtFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGtFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGtFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGtFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysGtFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGtFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGtFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGtFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGtFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGtFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGtFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysGtFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysGtFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGtIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGtIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..8731a2a3ab --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGtIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGtIntTintLogicalFunction::AlwaysGtIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysGtIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGtIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGtIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGtIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysGtIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGtIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGtIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGtIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGtIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGtIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGtIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysGtIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysGtIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGtTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGtTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..3e64d3b178 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGtTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGtTemporalTemporalLogicalFunction::AlwaysGtTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysGtTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGtTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGtTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGtTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AlwaysGtTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGtTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGtTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGtTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGtTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGtTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGtTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AlwaysGtTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AlwaysGtTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGtTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGtTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..d3807f6cb3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGtTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGtTfloatFloatLogicalFunction::AlwaysGtTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysGtTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGtTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGtTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGtTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysGtTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGtTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGtTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGtTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGtTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGtTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGtTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysGtTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysGtTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysGtTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysGtTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..1b5726e8b9 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysGtTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysGtTintIntLogicalFunction::AlwaysGtTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysGtTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysGtTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysGtTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysGtTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysGtTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysGtTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysGtTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysGtTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysGtTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysGtTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysGtTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysGtTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysGtTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLeFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLeFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..03f6f4d3d5 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLeFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLeFloatTfloatLogicalFunction::AlwaysLeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysLeFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLeFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLeFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLeFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysLeFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLeFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLeFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLeFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLeFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLeFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLeFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysLeFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysLeFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLeIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLeIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..57af19561c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLeIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLeIntTintLogicalFunction::AlwaysLeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysLeIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLeIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLeIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLeIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysLeIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLeIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLeIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLeIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLeIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLeIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLeIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysLeIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysLeIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLeTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLeTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..92cbccc85b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLeTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLeTemporalTemporalLogicalFunction::AlwaysLeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysLeTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLeTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLeTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLeTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AlwaysLeTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLeTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLeTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLeTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLeTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLeTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLeTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AlwaysLeTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AlwaysLeTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLeTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLeTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..b612fa18d3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLeTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLeTfloatFloatLogicalFunction::AlwaysLeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysLeTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLeTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLeTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLeTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysLeTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLeTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLeTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLeTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLeTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLeTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLeTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysLeTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysLeTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLeTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLeTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..fd39a476b5 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLeTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLeTintIntLogicalFunction::AlwaysLeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysLeTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLeTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLeTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLeTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysLeTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLeTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLeTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLeTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLeTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLeTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLeTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysLeTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysLeTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLtFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLtFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..9f5331e562 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLtFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLtFloatTfloatLogicalFunction::AlwaysLtFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysLtFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLtFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLtFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLtFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysLtFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLtFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLtFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLtFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLtFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLtFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLtFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysLtFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysLtFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLtIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLtIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..e6d6859f7f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLtIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLtIntTintLogicalFunction::AlwaysLtIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysLtIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLtIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLtIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLtIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysLtIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLtIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLtIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLtIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLtIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLtIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLtIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysLtIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysLtIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLtTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLtTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..94d273c37d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLtTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLtTemporalTemporalLogicalFunction::AlwaysLtTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysLtTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLtTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLtTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLtTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AlwaysLtTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLtTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLtTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLtTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLtTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLtTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLtTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AlwaysLtTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AlwaysLtTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLtTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLtTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..b2e5687405 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLtTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLtTfloatFloatLogicalFunction::AlwaysLtTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysLtTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLtTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLtTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLtTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysLtTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLtTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLtTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLtTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLtTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLtTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLtTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysLtTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysLtTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysLtTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysLtTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..97bf0f46fd --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysLtTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysLtTintIntLogicalFunction::AlwaysLtTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysLtTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysLtTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysLtTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysLtTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysLtTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysLtTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysLtTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysLtTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysLtTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysLtTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysLtTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysLtTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysLtTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..d03b586c2e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeFloatTfloatLogicalFunction::AlwaysNeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysNeFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysNeFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysNeFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysNeFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..efae699a90 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeIntTintLogicalFunction::AlwaysNeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysNeIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysNeIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysNeIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysNeIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeTboolBoolLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeTboolBoolLogicalFunction.cpp new file mode 100644 index 0000000000..48c09191e0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeTboolBoolLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeTboolBoolLogicalFunction::AlwaysNeTboolBoolLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType AlwaysNeTboolBoolLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeTboolBoolLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeTboolBoolLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeTboolBoolLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysNeTboolBoolLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeTboolBoolLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeTboolBoolLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeTboolBoolLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeTboolBoolLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeTboolBoolLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeTboolBoolLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysNeTboolBoolLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysNeTboolBoolLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeTcbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeTcbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..009f752527 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeTcbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeTcbufferCbufferLogicalFunction::AlwaysNeTcbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbuffer) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbuffer)); +} + +DataType AlwaysNeTcbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeTcbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeTcbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeTcbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "AlwaysNeTcbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeTcbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeTcbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeTcbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeTcbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeTcbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeTcbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "AlwaysNeTcbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return AlwaysNeTcbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeTcbufferTcbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeTcbufferTcbufferLogicalFunction.cpp new file mode 100644 index 0000000000..7ef37621f2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeTcbufferTcbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeTcbufferTcbufferLogicalFunction::AlwaysNeTcbufferTcbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysNeTcbufferTcbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeTcbufferTcbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeTcbufferTcbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeTcbufferTcbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "AlwaysNeTcbufferTcbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeTcbufferTcbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeTcbufferTcbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeTcbufferTcbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeTcbufferTcbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeTcbufferTcbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeTcbufferTcbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "AlwaysNeTcbufferTcbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return AlwaysNeTcbufferTcbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..a553579425 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeTemporalTemporalLogicalFunction::AlwaysNeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysNeTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AlwaysNeTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AlwaysNeTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AlwaysNeTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..22ffc223b6 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeTfloatFloatLogicalFunction::AlwaysNeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysNeTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysNeTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysNeTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysNeTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeTgeoGeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeTgeoGeoLogicalFunction.cpp new file mode 100644 index 0000000000..0293265041 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeTgeoGeoLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeTgeoGeoLogicalFunction::AlwaysNeTgeoGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType AlwaysNeTgeoGeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeTgeoGeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeTgeoGeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeTgeoGeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AlwaysNeTgeoGeoLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeTgeoGeoLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeTgeoGeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeTgeoGeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeTgeoGeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeTgeoGeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeTgeoGeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AlwaysNeTgeoGeoLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AlwaysNeTgeoGeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeTgeoTgeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeTgeoTgeoLogicalFunction.cpp new file mode 100644 index 0000000000..829b58a41c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeTgeoTgeoLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeTgeoTgeoLogicalFunction::AlwaysNeTgeoTgeoLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType AlwaysNeTgeoTgeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeTgeoTgeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeTgeoTgeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeTgeoTgeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "AlwaysNeTgeoTgeoLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeTgeoTgeoLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeTgeoTgeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeTgeoTgeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeTgeoTgeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeTgeoTgeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeTgeoTgeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "AlwaysNeTgeoTgeoLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return AlwaysNeTgeoTgeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AlwaysNeTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AlwaysNeTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..1e6e077dc8 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AlwaysNeTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AlwaysNeTintIntLogicalFunction::AlwaysNeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType AlwaysNeTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AlwaysNeTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AlwaysNeTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AlwaysNeTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "AlwaysNeTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AlwaysNeTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool AlwaysNeTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AlwaysNeTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AlwaysNeTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AlwaysNeTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAlwaysNeTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "AlwaysNeTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return AlwaysNeTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/AtouchesTpointGeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/AtouchesTpointGeoLogicalFunction.cpp new file mode 100644 index 0000000000..267f4fd942 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/AtouchesTpointGeoLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +AtouchesTpointGeoLogicalFunction::AtouchesTpointGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType AtouchesTpointGeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction AtouchesTpointGeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector AtouchesTpointGeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction AtouchesTpointGeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "AtouchesTpointGeoLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view AtouchesTpointGeoLogicalFunction::getType() const +{ + return NAME; +} + +bool AtouchesTpointGeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string AtouchesTpointGeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction AtouchesTpointGeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction AtouchesTpointGeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterAtouchesTpointGeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "AtouchesTpointGeoLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return AtouchesTpointGeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BackStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BackStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..1e034c09ca --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BackStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BackStboxStboxLogicalFunction::BackStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType BackStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BackStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BackStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BackStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "BackStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BackStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool BackStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BackStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BackStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BackStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBackStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "BackStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return BackStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BackStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BackStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..f92e6c6c02 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BackStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BackStboxTspatialLogicalFunction::BackStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType BackStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BackStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BackStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BackStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "BackStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BackStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool BackStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BackStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BackStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BackStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBackStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "BackStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return BackStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BackTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BackTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..b11fab303c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BackTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BackTspatialStboxLogicalFunction::BackTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType BackTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BackTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BackTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BackTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "BackTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BackTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool BackTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BackTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BackTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BackTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBackTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "BackTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return BackTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BackTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BackTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..b343129ae4 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BackTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BackTspatialTspatialLogicalFunction::BackTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType BackTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BackTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BackTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BackTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "BackTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BackTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool BackTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BackTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BackTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BackTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBackTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "BackTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return BackTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BeforeStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BeforeStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..ee3a496776 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BeforeStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BeforeStboxStboxLogicalFunction::BeforeStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType BeforeStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BeforeStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BeforeStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BeforeStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "BeforeStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BeforeStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool BeforeStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BeforeStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BeforeStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BeforeStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBeforeStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "BeforeStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return BeforeStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BeforeStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BeforeStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..af952752bd --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BeforeStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BeforeStboxTspatialLogicalFunction::BeforeStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType BeforeStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BeforeStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BeforeStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BeforeStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "BeforeStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BeforeStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool BeforeStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BeforeStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BeforeStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BeforeStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBeforeStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "BeforeStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return BeforeStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BeforeTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BeforeTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..5688fa4f54 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BeforeTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BeforeTboxTnumberLogicalFunction::BeforeTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType BeforeTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BeforeTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BeforeTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BeforeTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "BeforeTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BeforeTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool BeforeTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BeforeTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BeforeTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BeforeTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBeforeTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "BeforeTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return BeforeTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BeforeTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BeforeTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..56e5ccd331 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BeforeTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BeforeTemporalTemporalLogicalFunction::BeforeTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType BeforeTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BeforeTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BeforeTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BeforeTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "BeforeTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BeforeTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool BeforeTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BeforeTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BeforeTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BeforeTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBeforeTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "BeforeTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return BeforeTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BeforeTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BeforeTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..1296402088 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BeforeTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BeforeTnumberTboxLogicalFunction::BeforeTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType BeforeTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BeforeTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BeforeTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BeforeTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "BeforeTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BeforeTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool BeforeTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BeforeTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BeforeTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BeforeTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBeforeTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "BeforeTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return BeforeTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BeforeTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BeforeTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..a20e950669 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BeforeTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BeforeTnumberTnumberLogicalFunction::BeforeTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType BeforeTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BeforeTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BeforeTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BeforeTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "BeforeTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BeforeTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool BeforeTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BeforeTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BeforeTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BeforeTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBeforeTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "BeforeTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return BeforeTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BeforeTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BeforeTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..61afaf241d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BeforeTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BeforeTspatialStboxLogicalFunction::BeforeTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType BeforeTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BeforeTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BeforeTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BeforeTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "BeforeTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BeforeTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool BeforeTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BeforeTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BeforeTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BeforeTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBeforeTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "BeforeTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return BeforeTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BeforeTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BeforeTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..82d6652dbb --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BeforeTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BeforeTspatialTspatialLogicalFunction::BeforeTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType BeforeTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BeforeTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BeforeTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BeforeTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "BeforeTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BeforeTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool BeforeTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BeforeTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BeforeTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BeforeTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBeforeTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "BeforeTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return BeforeTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BelowStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BelowStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..33b643a0f1 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BelowStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BelowStboxStboxLogicalFunction::BelowStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType BelowStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BelowStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BelowStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BelowStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "BelowStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BelowStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool BelowStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BelowStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BelowStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BelowStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBelowStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "BelowStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return BelowStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BelowStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BelowStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..0b280d7387 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BelowStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BelowStboxTspatialLogicalFunction::BelowStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType BelowStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BelowStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BelowStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BelowStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "BelowStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BelowStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool BelowStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BelowStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BelowStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BelowStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBelowStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "BelowStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return BelowStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BelowTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BelowTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..994dfe384b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BelowTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BelowTspatialStboxLogicalFunction::BelowTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType BelowTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BelowTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BelowTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BelowTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "BelowTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BelowTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool BelowTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BelowTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BelowTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BelowTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBelowTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "BelowTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return BelowTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/BelowTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/BelowTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..9f9307e627 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/BelowTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +BelowTspatialTspatialLogicalFunction::BelowTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType BelowTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction BelowTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector BelowTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction BelowTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "BelowTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view BelowTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool BelowTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string BelowTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction BelowTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction BelowTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterBelowTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "BelowTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return BelowTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/CMakeLists.txt b/nes-logical-operators/src/Functions/Meos/CMakeLists.txt index 474ba11608..7e1e97c343 100644 --- a/nes-logical-operators/src/Functions/Meos/CMakeLists.txt +++ b/nes-logical-operators/src/Functions/Meos/CMakeLists.txt @@ -18,3 +18,367 @@ add_plugin(TemporalAIntersectsGeometry LogicalFunction nes-logical-operators Tem add_plugin(TemporalEContainsGeometry LogicalFunction nes-logical-operators TemporalEContainsGeometryLogicalFunction.cpp) add_plugin(TemporalEDWithinGeometry LogicalFunction nes-logical-operators TemporalEDWithinGeometryLogicalFunction.cpp) add_plugin(TemporalAtStBox LogicalFunction nes-logical-operators TemporalAtStBoxLogicalFunction.cpp) +add_plugin(TemporalEDisjointGeometry LogicalFunction nes-logical-operators TemporalEDisjointGeometryLogicalFunction.cpp) +add_plugin(TemporalATouchesGeometry LogicalFunction nes-logical-operators TemporalATouchesGeometryLogicalFunction.cpp) +add_plugin(TemporalECoversGeometry LogicalFunction nes-logical-operators TemporalECoversGeometryLogicalFunction.cpp) +add_plugin(TemporalAContainsGeometry LogicalFunction nes-logical-operators TemporalAContainsGeometryLogicalFunction.cpp) +add_plugin(TemporalETouchesGeometry LogicalFunction nes-logical-operators TemporalETouchesGeometryLogicalFunction.cpp) +add_plugin(TemporalADisjointGeometry LogicalFunction nes-logical-operators TemporalADisjointGeometryLogicalFunction.cpp) +add_plugin(TemporalEIntersectsGeometry LogicalFunction nes-logical-operators TemporalEIntersectsGeometryLogicalFunction.cpp) +add_plugin(TemporalEContainsTGeometry LogicalFunction nes-logical-operators TemporalEContainsTGeometryLogicalFunction.cpp) +add_plugin(TemporalECoversTGeometry LogicalFunction nes-logical-operators TemporalECoversTGeometryLogicalFunction.cpp) +add_plugin(TemporalEDisjointTGeometry LogicalFunction nes-logical-operators TemporalEDisjointTGeometryLogicalFunction.cpp) +add_plugin(TemporalEIntersectsTGeometry LogicalFunction nes-logical-operators TemporalEIntersectsTGeometryLogicalFunction.cpp) +add_plugin(TemporalETouchesTGeometry LogicalFunction nes-logical-operators TemporalETouchesTGeometryLogicalFunction.cpp) +add_plugin(TemporalAContainsTGeometry LogicalFunction nes-logical-operators TemporalAContainsTGeometryLogicalFunction.cpp) +add_plugin(TemporalADisjointTGeometry LogicalFunction nes-logical-operators TemporalADisjointTGeometryLogicalFunction.cpp) +add_plugin(TemporalAIntersectsTGeometry LogicalFunction nes-logical-operators TemporalAIntersectsTGeometryLogicalFunction.cpp) +add_plugin(TemporalATouchesTGeometry LogicalFunction nes-logical-operators TemporalATouchesTGeometryLogicalFunction.cpp) +add_plugin(TemporalNADGeometry LogicalFunction nes-logical-operators TemporalNADGeometryLogicalFunction.cpp) +add_plugin(TemporalNADTGeometry LogicalFunction nes-logical-operators TemporalNADTGeometryLogicalFunction.cpp) +add_plugin(TemporalEDWithinTGeometry LogicalFunction nes-logical-operators TemporalEDWithinTGeometryLogicalFunction.cpp) +add_plugin(TemporalADWithinGeometry LogicalFunction nes-logical-operators TemporalADWithinGeometryLogicalFunction.cpp) +add_plugin(TemporalADWithinTGeometry LogicalFunction nes-logical-operators TemporalADWithinTGeometryLogicalFunction.cpp) +add_plugin(TemporalNADFloatScalar LogicalFunction nes-logical-operators TemporalNADFloatScalarLogicalFunction.cpp) +add_plugin(TemporalNADIntScalar LogicalFunction nes-logical-operators TemporalNADIntScalarLogicalFunction.cpp) +add_plugin(TemporalNADTFloat LogicalFunction nes-logical-operators TemporalNADTFloatLogicalFunction.cpp) +add_plugin(TemporalNADTInt LogicalFunction nes-logical-operators TemporalNADTIntLogicalFunction.cpp) +add_plugin(TemporalAtGeometry LogicalFunction nes-logical-operators TemporalAtGeometryLogicalFunction.cpp) +add_plugin(TemporalMinusGeometry LogicalFunction nes-logical-operators TemporalMinusGeometryLogicalFunction.cpp) +add_plugin(TemporalEContainsTCbuffer LogicalFunction nes-logical-operators TemporalEContainsTCbufferLogicalFunction.cpp) +add_plugin(TemporalECoversTCbuffer LogicalFunction nes-logical-operators TemporalECoversTCbufferLogicalFunction.cpp) +add_plugin(TemporalEDisjointTCbuffer LogicalFunction nes-logical-operators TemporalEDisjointTCbufferLogicalFunction.cpp) +add_plugin(TemporalEIntersectsTCbuffer LogicalFunction nes-logical-operators TemporalEIntersectsTCbufferLogicalFunction.cpp) +add_plugin(TemporalETouchesTCbuffer LogicalFunction nes-logical-operators TemporalETouchesTCbufferLogicalFunction.cpp) +add_plugin(TemporalAContainsTCbuffer LogicalFunction nes-logical-operators TemporalAContainsTCbufferLogicalFunction.cpp) +add_plugin(TemporalACoversTCbuffer LogicalFunction nes-logical-operators TemporalACoversTCbufferLogicalFunction.cpp) +add_plugin(TemporalADisjointTCbuffer LogicalFunction nes-logical-operators TemporalADisjointTCbufferLogicalFunction.cpp) +add_plugin(TemporalAIntersectsTCbuffer LogicalFunction nes-logical-operators TemporalAIntersectsTCbufferLogicalFunction.cpp) +add_plugin(TemporalATouchesTCbuffer LogicalFunction nes-logical-operators TemporalATouchesTCbufferLogicalFunction.cpp) +add_plugin(TemporalEContainsTCbufferCbuffer LogicalFunction nes-logical-operators TemporalEContainsTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalECoversTCbufferCbuffer LogicalFunction nes-logical-operators TemporalECoversTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalEDisjointTCbufferCbuffer LogicalFunction nes-logical-operators TemporalEDisjointTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalEIntersectsTCbufferCbuffer LogicalFunction nes-logical-operators TemporalEIntersectsTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalETouchesTCbufferCbuffer LogicalFunction nes-logical-operators TemporalETouchesTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalAContainsTCbufferCbuffer LogicalFunction nes-logical-operators TemporalAContainsTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalACoversTCbufferCbuffer LogicalFunction nes-logical-operators TemporalACoversTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalADisjointTCbufferCbuffer LogicalFunction nes-logical-operators TemporalADisjointTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalAIntersectsTCbufferCbuffer LogicalFunction nes-logical-operators TemporalAIntersectsTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalATouchesTCbufferCbuffer LogicalFunction nes-logical-operators TemporalATouchesTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalADisjointTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalADisjointTCbufferTCbufferLogicalFunction.cpp) +add_plugin(TemporalAIntersectsTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalAIntersectsTCbufferTCbufferLogicalFunction.cpp) +add_plugin(TemporalATouchesTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalATouchesTCbufferTCbufferLogicalFunction.cpp) +add_plugin(TemporalECoversTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalECoversTCbufferTCbufferLogicalFunction.cpp) +add_plugin(TemporalEIntersectsTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalEIntersectsTCbufferTCbufferLogicalFunction.cpp) +add_plugin(TemporalETouchesTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalETouchesTCbufferTCbufferLogicalFunction.cpp) +add_plugin(TemporalEDWithinTCbufferGeometry LogicalFunction nes-logical-operators TemporalEDWithinTCbufferGeometryLogicalFunction.cpp) +add_plugin(TemporalADWithinTCbufferGeometry LogicalFunction nes-logical-operators TemporalADWithinTCbufferGeometryLogicalFunction.cpp) +add_plugin(TemporalEDWithinTCbufferCbuffer LogicalFunction nes-logical-operators TemporalEDWithinTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalADWithinTCbufferCbuffer LogicalFunction nes-logical-operators TemporalADWithinTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalEDWithinTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalEDWithinTCbufferTCbufferLogicalFunction.cpp) +add_plugin(TemporalADWithinTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalADWithinTCbufferTCbufferLogicalFunction.cpp) +add_plugin(TemporalEContainsTPoseGeometry LogicalFunction nes-logical-operators TemporalEContainsTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalECoversTPoseGeometry LogicalFunction nes-logical-operators TemporalECoversTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalEDisjointTPoseGeometry LogicalFunction nes-logical-operators TemporalEDisjointTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalEIntersectsTPoseGeometry LogicalFunction nes-logical-operators TemporalEIntersectsTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalETouchesTPoseGeometry LogicalFunction nes-logical-operators TemporalETouchesTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalAContainsTPoseGeometry LogicalFunction nes-logical-operators TemporalAContainsTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalADisjointTPoseGeometry LogicalFunction nes-logical-operators TemporalADisjointTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalAIntersectsTPoseGeometry LogicalFunction nes-logical-operators TemporalAIntersectsTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalATouchesTPoseGeometry LogicalFunction nes-logical-operators TemporalATouchesTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalEContainsTPoseTPose LogicalFunction nes-logical-operators TemporalEContainsTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalECoversTPoseTPose LogicalFunction nes-logical-operators TemporalECoversTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalEDisjointTPoseTPose LogicalFunction nes-logical-operators TemporalEDisjointTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalEIntersectsTPoseTPose LogicalFunction nes-logical-operators TemporalEIntersectsTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalETouchesTPoseTPose LogicalFunction nes-logical-operators TemporalETouchesTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalAContainsTPoseTPose LogicalFunction nes-logical-operators TemporalAContainsTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalADisjointTPoseTPose LogicalFunction nes-logical-operators TemporalADisjointTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalAIntersectsTPoseTPose LogicalFunction nes-logical-operators TemporalAIntersectsTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalATouchesTPoseTPose LogicalFunction nes-logical-operators TemporalATouchesTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalEContainsTNpointGeometry LogicalFunction nes-logical-operators TemporalEContainsTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalEContainsTNpointTNpoint LogicalFunction nes-logical-operators TemporalEContainsTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalECoversTNpointGeometry LogicalFunction nes-logical-operators TemporalECoversTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalECoversTNpointTNpoint LogicalFunction nes-logical-operators TemporalECoversTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalEDisjointTNpointGeometry LogicalFunction nes-logical-operators TemporalEDisjointTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalEDisjointTNpointTNpoint LogicalFunction nes-logical-operators TemporalEDisjointTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalEIntersectsTNpointGeometry LogicalFunction nes-logical-operators TemporalEIntersectsTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalEIntersectsTNpointTNpoint LogicalFunction nes-logical-operators TemporalEIntersectsTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalETouchesTNpointGeometry LogicalFunction nes-logical-operators TemporalETouchesTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalETouchesTNpointTNpoint LogicalFunction nes-logical-operators TemporalETouchesTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalAContainsTNpointGeometry LogicalFunction nes-logical-operators TemporalAContainsTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalAContainsTNpointTNpoint LogicalFunction nes-logical-operators TemporalAContainsTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalADisjointTNpointGeometry LogicalFunction nes-logical-operators TemporalADisjointTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalADisjointTNpointTNpoint LogicalFunction nes-logical-operators TemporalADisjointTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalAIntersectsTNpointGeometry LogicalFunction nes-logical-operators TemporalAIntersectsTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalAIntersectsTNpointTNpoint LogicalFunction nes-logical-operators TemporalAIntersectsTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalATouchesTNpointGeometry LogicalFunction nes-logical-operators TemporalATouchesTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalATouchesTNpointTNpoint LogicalFunction nes-logical-operators TemporalATouchesTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalNADTPoseGeometry LogicalFunction nes-logical-operators TemporalNADTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalNADTPoseTPose LogicalFunction nes-logical-operators TemporalNADTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalNADTNpointGeometry LogicalFunction nes-logical-operators TemporalNADTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalNADTNpointTNpoint LogicalFunction nes-logical-operators TemporalNADTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalEDWithinTPoseGeometry LogicalFunction nes-logical-operators TemporalEDWithinTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalEDWithinTPoseTPose LogicalFunction nes-logical-operators TemporalEDWithinTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalEDWithinTNpointGeometry LogicalFunction nes-logical-operators TemporalEDWithinTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalEDWithinTNpointTNpoint LogicalFunction nes-logical-operators TemporalEDWithinTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalADWithinTPoseGeometry LogicalFunction nes-logical-operators TemporalADWithinTPoseGeometryLogicalFunction.cpp) +add_plugin(TemporalADWithinTPoseTPose LogicalFunction nes-logical-operators TemporalADWithinTPoseTPoseLogicalFunction.cpp) +add_plugin(TemporalADWithinTNpointGeometry LogicalFunction nes-logical-operators TemporalADWithinTNpointGeometryLogicalFunction.cpp) +add_plugin(TemporalADWithinTNpointTNpoint LogicalFunction nes-logical-operators TemporalADWithinTNpointTNpointLogicalFunction.cpp) +add_plugin(TemporalNADTCbuffer LogicalFunction nes-logical-operators TemporalNADTCbufferLogicalFunction.cpp) +add_plugin(TemporalNADTCbufferCbuffer LogicalFunction nes-logical-operators TemporalNADTCbufferCbufferLogicalFunction.cpp) +add_plugin(TemporalNADTCbufferTCbuffer LogicalFunction nes-logical-operators TemporalNADTCbufferTCbufferLogicalFunction.cpp) +add_plugin(AlwaysEqTfloatFloat LogicalFunction nes-logical-operators AlwaysEqTfloatFloatLogicalFunction.cpp) +add_plugin(AlwaysEqTintInt LogicalFunction nes-logical-operators AlwaysEqTintIntLogicalFunction.cpp) +add_plugin(AlwaysGeTfloatFloat LogicalFunction nes-logical-operators AlwaysGeTfloatFloatLogicalFunction.cpp) +add_plugin(AlwaysGeTintInt LogicalFunction nes-logical-operators AlwaysGeTintIntLogicalFunction.cpp) +add_plugin(AlwaysGtTfloatFloat LogicalFunction nes-logical-operators AlwaysGtTfloatFloatLogicalFunction.cpp) +add_plugin(AlwaysGtTintInt LogicalFunction nes-logical-operators AlwaysGtTintIntLogicalFunction.cpp) +add_plugin(AlwaysLeTfloatFloat LogicalFunction nes-logical-operators AlwaysLeTfloatFloatLogicalFunction.cpp) +add_plugin(AlwaysLeTintInt LogicalFunction nes-logical-operators AlwaysLeTintIntLogicalFunction.cpp) +add_plugin(AlwaysLtTfloatFloat LogicalFunction nes-logical-operators AlwaysLtTfloatFloatLogicalFunction.cpp) +add_plugin(AlwaysLtTintInt LogicalFunction nes-logical-operators AlwaysLtTintIntLogicalFunction.cpp) +add_plugin(AlwaysNeTfloatFloat LogicalFunction nes-logical-operators AlwaysNeTfloatFloatLogicalFunction.cpp) +add_plugin(AlwaysNeTintInt LogicalFunction nes-logical-operators AlwaysNeTintIntLogicalFunction.cpp) +add_plugin(EverEqTfloatFloat LogicalFunction nes-logical-operators EverEqTfloatFloatLogicalFunction.cpp) +add_plugin(EverEqTintInt LogicalFunction nes-logical-operators EverEqTintIntLogicalFunction.cpp) +add_plugin(EverGeTfloatFloat LogicalFunction nes-logical-operators EverGeTfloatFloatLogicalFunction.cpp) +add_plugin(EverGeTintInt LogicalFunction nes-logical-operators EverGeTintIntLogicalFunction.cpp) +add_plugin(EverGtTfloatFloat LogicalFunction nes-logical-operators EverGtTfloatFloatLogicalFunction.cpp) +add_plugin(EverGtTintInt LogicalFunction nes-logical-operators EverGtTintIntLogicalFunction.cpp) +add_plugin(EverLeTfloatFloat LogicalFunction nes-logical-operators EverLeTfloatFloatLogicalFunction.cpp) +add_plugin(EverLeTintInt LogicalFunction nes-logical-operators EverLeTintIntLogicalFunction.cpp) +add_plugin(EverLtTfloatFloat LogicalFunction nes-logical-operators EverLtTfloatFloatLogicalFunction.cpp) +add_plugin(EverLtTintInt LogicalFunction nes-logical-operators EverLtTintIntLogicalFunction.cpp) +add_plugin(EverNeTfloatFloat LogicalFunction nes-logical-operators EverNeTfloatFloatLogicalFunction.cpp) +add_plugin(EverNeTintInt LogicalFunction nes-logical-operators EverNeTintIntLogicalFunction.cpp) +add_plugin(AlwaysEqFloatTfloat LogicalFunction nes-logical-operators AlwaysEqFloatTfloatLogicalFunction.cpp) +add_plugin(AlwaysEqIntTint LogicalFunction nes-logical-operators AlwaysEqIntTintLogicalFunction.cpp) +add_plugin(AlwaysEqTemporalTemporal LogicalFunction nes-logical-operators AlwaysEqTemporalTemporalLogicalFunction.cpp) +add_plugin(AlwaysGeFloatTfloat LogicalFunction nes-logical-operators AlwaysGeFloatTfloatLogicalFunction.cpp) +add_plugin(AlwaysGeIntTint LogicalFunction nes-logical-operators AlwaysGeIntTintLogicalFunction.cpp) +add_plugin(AlwaysGeTemporalTemporal LogicalFunction nes-logical-operators AlwaysGeTemporalTemporalLogicalFunction.cpp) +add_plugin(AlwaysGtFloatTfloat LogicalFunction nes-logical-operators AlwaysGtFloatTfloatLogicalFunction.cpp) +add_plugin(AlwaysGtIntTint LogicalFunction nes-logical-operators AlwaysGtIntTintLogicalFunction.cpp) +add_plugin(AlwaysGtTemporalTemporal LogicalFunction nes-logical-operators AlwaysGtTemporalTemporalLogicalFunction.cpp) +add_plugin(AlwaysLeFloatTfloat LogicalFunction nes-logical-operators AlwaysLeFloatTfloatLogicalFunction.cpp) +add_plugin(AlwaysLeIntTint LogicalFunction nes-logical-operators AlwaysLeIntTintLogicalFunction.cpp) +add_plugin(AlwaysLeTemporalTemporal LogicalFunction nes-logical-operators AlwaysLeTemporalTemporalLogicalFunction.cpp) +add_plugin(AlwaysLtFloatTfloat LogicalFunction nes-logical-operators AlwaysLtFloatTfloatLogicalFunction.cpp) +add_plugin(AlwaysLtIntTint LogicalFunction nes-logical-operators AlwaysLtIntTintLogicalFunction.cpp) +add_plugin(AlwaysLtTemporalTemporal LogicalFunction nes-logical-operators AlwaysLtTemporalTemporalLogicalFunction.cpp) +add_plugin(AlwaysNeFloatTfloat LogicalFunction nes-logical-operators AlwaysNeFloatTfloatLogicalFunction.cpp) +add_plugin(AlwaysNeIntTint LogicalFunction nes-logical-operators AlwaysNeIntTintLogicalFunction.cpp) +add_plugin(AlwaysNeTemporalTemporal LogicalFunction nes-logical-operators AlwaysNeTemporalTemporalLogicalFunction.cpp) +add_plugin(EverEqFloatTfloat LogicalFunction nes-logical-operators EverEqFloatTfloatLogicalFunction.cpp) +add_plugin(EverEqIntTint LogicalFunction nes-logical-operators EverEqIntTintLogicalFunction.cpp) +add_plugin(EverEqTemporalTemporal LogicalFunction nes-logical-operators EverEqTemporalTemporalLogicalFunction.cpp) +add_plugin(EverGeFloatTfloat LogicalFunction nes-logical-operators EverGeFloatTfloatLogicalFunction.cpp) +add_plugin(EverGeIntTint LogicalFunction nes-logical-operators EverGeIntTintLogicalFunction.cpp) +add_plugin(EverGeTemporalTemporal LogicalFunction nes-logical-operators EverGeTemporalTemporalLogicalFunction.cpp) +add_plugin(EverGtFloatTfloat LogicalFunction nes-logical-operators EverGtFloatTfloatLogicalFunction.cpp) +add_plugin(EverGtIntTint LogicalFunction nes-logical-operators EverGtIntTintLogicalFunction.cpp) +add_plugin(EverGtTemporalTemporal LogicalFunction nes-logical-operators EverGtTemporalTemporalLogicalFunction.cpp) +add_plugin(EverLeFloatTfloat LogicalFunction nes-logical-operators EverLeFloatTfloatLogicalFunction.cpp) +add_plugin(EverLeIntTint LogicalFunction nes-logical-operators EverLeIntTintLogicalFunction.cpp) +add_plugin(EverLeTemporalTemporal LogicalFunction nes-logical-operators EverLeTemporalTemporalLogicalFunction.cpp) +add_plugin(EverLtFloatTfloat LogicalFunction nes-logical-operators EverLtFloatTfloatLogicalFunction.cpp) +add_plugin(EverLtIntTint LogicalFunction nes-logical-operators EverLtIntTintLogicalFunction.cpp) +add_plugin(EverLtTemporalTemporal LogicalFunction nes-logical-operators EverLtTemporalTemporalLogicalFunction.cpp) +add_plugin(EverNeFloatTfloat LogicalFunction nes-logical-operators EverNeFloatTfloatLogicalFunction.cpp) +add_plugin(EverNeIntTint LogicalFunction nes-logical-operators EverNeIntTintLogicalFunction.cpp) +add_plugin(EverNeTemporalTemporal LogicalFunction nes-logical-operators EverNeTemporalTemporalLogicalFunction.cpp) +add_plugin(AlwaysEqTcbufferCbuffer LogicalFunction nes-logical-operators AlwaysEqTcbufferCbufferLogicalFunction.cpp) +add_plugin(AlwaysEqTcbufferTcbuffer LogicalFunction nes-logical-operators AlwaysEqTcbufferTcbufferLogicalFunction.cpp) +add_plugin(AlwaysEqTgeoGeo LogicalFunction nes-logical-operators AlwaysEqTgeoGeoLogicalFunction.cpp) +add_plugin(AlwaysEqTgeoTgeo LogicalFunction nes-logical-operators AlwaysEqTgeoTgeoLogicalFunction.cpp) +add_plugin(AlwaysNeTcbufferCbuffer LogicalFunction nes-logical-operators AlwaysNeTcbufferCbufferLogicalFunction.cpp) +add_plugin(AlwaysNeTcbufferTcbuffer LogicalFunction nes-logical-operators AlwaysNeTcbufferTcbufferLogicalFunction.cpp) +add_plugin(AlwaysNeTgeoGeo LogicalFunction nes-logical-operators AlwaysNeTgeoGeoLogicalFunction.cpp) +add_plugin(AlwaysNeTgeoTgeo LogicalFunction nes-logical-operators AlwaysNeTgeoTgeoLogicalFunction.cpp) +add_plugin(AtouchesTpointGeo LogicalFunction nes-logical-operators AtouchesTpointGeoLogicalFunction.cpp) +add_plugin(EtouchesTpointGeo LogicalFunction nes-logical-operators EtouchesTpointGeoLogicalFunction.cpp) +add_plugin(EverEqTcbufferCbuffer LogicalFunction nes-logical-operators EverEqTcbufferCbufferLogicalFunction.cpp) +add_plugin(EverEqTcbufferTcbuffer LogicalFunction nes-logical-operators EverEqTcbufferTcbufferLogicalFunction.cpp) +add_plugin(EverEqTgeoGeo LogicalFunction nes-logical-operators EverEqTgeoGeoLogicalFunction.cpp) +add_plugin(EverEqTgeoTgeo LogicalFunction nes-logical-operators EverEqTgeoTgeoLogicalFunction.cpp) +add_plugin(EverNeTcbufferCbuffer LogicalFunction nes-logical-operators EverNeTcbufferCbufferLogicalFunction.cpp) +add_plugin(EverNeTcbufferTcbuffer LogicalFunction nes-logical-operators EverNeTcbufferTcbufferLogicalFunction.cpp) +add_plugin(EverNeTgeoGeo LogicalFunction nes-logical-operators EverNeTgeoGeoLogicalFunction.cpp) +add_plugin(EverNeTgeoTgeo LogicalFunction nes-logical-operators EverNeTgeoTgeoLogicalFunction.cpp) +add_plugin(TboolEndValue LogicalFunction nes-logical-operators TboolEndValueLogicalFunction.cpp) +add_plugin(TboolStartValue LogicalFunction nes-logical-operators TboolStartValueLogicalFunction.cpp) +add_plugin(TnpointLength LogicalFunction nes-logical-operators TnpointLengthLogicalFunction.cpp) +add_plugin(AboveTspatialTspatial LogicalFunction nes-logical-operators AboveTspatialTspatialLogicalFunction.cpp) +add_plugin(AdjacentTemporalTemporal LogicalFunction nes-logical-operators AdjacentTemporalTemporalLogicalFunction.cpp) +add_plugin(AdjacentTspatialTspatial LogicalFunction nes-logical-operators AdjacentTspatialTspatialLogicalFunction.cpp) +add_plugin(AfterTemporalTemporal LogicalFunction nes-logical-operators AfterTemporalTemporalLogicalFunction.cpp) +add_plugin(AfterTspatialTspatial LogicalFunction nes-logical-operators AfterTspatialTspatialLogicalFunction.cpp) +add_plugin(AlwaysEqTboolBool LogicalFunction nes-logical-operators AlwaysEqTboolBoolLogicalFunction.cpp) +add_plugin(AlwaysNeTboolBool LogicalFunction nes-logical-operators AlwaysNeTboolBoolLogicalFunction.cpp) +add_plugin(BackTspatialTspatial LogicalFunction nes-logical-operators BackTspatialTspatialLogicalFunction.cpp) +add_plugin(BeforeTemporalTemporal LogicalFunction nes-logical-operators BeforeTemporalTemporalLogicalFunction.cpp) +add_plugin(BeforeTspatialTspatial LogicalFunction nes-logical-operators BeforeTspatialTspatialLogicalFunction.cpp) +add_plugin(BelowTspatialTspatial LogicalFunction nes-logical-operators BelowTspatialTspatialLogicalFunction.cpp) +add_plugin(ContainedTemporalTemporal LogicalFunction nes-logical-operators ContainedTemporalTemporalLogicalFunction.cpp) +add_plugin(ContainedTspatialTspatial LogicalFunction nes-logical-operators ContainedTspatialTspatialLogicalFunction.cpp) +add_plugin(ContainsTemporalTemporal LogicalFunction nes-logical-operators ContainsTemporalTemporalLogicalFunction.cpp) +add_plugin(ContainsTspatialTspatial LogicalFunction nes-logical-operators ContainsTspatialTspatialLogicalFunction.cpp) +add_plugin(EverEqTboolBool LogicalFunction nes-logical-operators EverEqTboolBoolLogicalFunction.cpp) +add_plugin(EverNeTboolBool LogicalFunction nes-logical-operators EverNeTboolBoolLogicalFunction.cpp) +add_plugin(FrontTspatialTspatial LogicalFunction nes-logical-operators FrontTspatialTspatialLogicalFunction.cpp) +add_plugin(LeftTspatialTspatial LogicalFunction nes-logical-operators LeftTspatialTspatialLogicalFunction.cpp) +add_plugin(NadTnpointGeo LogicalFunction nes-logical-operators NadTnpointGeoLogicalFunction.cpp) +add_plugin(NadTposeGeo LogicalFunction nes-logical-operators NadTposeGeoLogicalFunction.cpp) +add_plugin(OveraboveTspatialTspatial LogicalFunction nes-logical-operators OveraboveTspatialTspatialLogicalFunction.cpp) +add_plugin(OverafterTemporalTemporal LogicalFunction nes-logical-operators OverafterTemporalTemporalLogicalFunction.cpp) +add_plugin(OverafterTspatialTspatial LogicalFunction nes-logical-operators OverafterTspatialTspatialLogicalFunction.cpp) +add_plugin(OverbackTspatialTspatial LogicalFunction nes-logical-operators OverbackTspatialTspatialLogicalFunction.cpp) +add_plugin(OverbeforeTemporalTemporal LogicalFunction nes-logical-operators OverbeforeTemporalTemporalLogicalFunction.cpp) +add_plugin(OverbeforeTspatialTspatial LogicalFunction nes-logical-operators OverbeforeTspatialTspatialLogicalFunction.cpp) +add_plugin(OverbelowTspatialTspatial LogicalFunction nes-logical-operators OverbelowTspatialTspatialLogicalFunction.cpp) +add_plugin(OverfrontTspatialTspatial LogicalFunction nes-logical-operators OverfrontTspatialTspatialLogicalFunction.cpp) +add_plugin(OverlapsTemporalTemporal LogicalFunction nes-logical-operators OverlapsTemporalTemporalLogicalFunction.cpp) +add_plugin(OverlapsTspatialTspatial LogicalFunction nes-logical-operators OverlapsTspatialTspatialLogicalFunction.cpp) +add_plugin(OverleftTspatialTspatial LogicalFunction nes-logical-operators OverleftTspatialTspatialLogicalFunction.cpp) +add_plugin(OverrightTspatialTspatial LogicalFunction nes-logical-operators OverrightTspatialTspatialLogicalFunction.cpp) +add_plugin(RightTspatialTspatial LogicalFunction nes-logical-operators RightTspatialTspatialLogicalFunction.cpp) +add_plugin(SameTemporalTemporal LogicalFunction nes-logical-operators SameTemporalTemporalLogicalFunction.cpp) +add_plugin(SameTspatialTspatial LogicalFunction nes-logical-operators SameTspatialTspatialLogicalFunction.cpp) +add_plugin(TemporalCmp LogicalFunction nes-logical-operators TemporalCmpLogicalFunction.cpp) +add_plugin(TemporalDyntimewarpDistance LogicalFunction nes-logical-operators TemporalDyntimewarpDistanceLogicalFunction.cpp) +add_plugin(TemporalEq LogicalFunction nes-logical-operators TemporalEqLogicalFunction.cpp) +add_plugin(TemporalFrechetDistance LogicalFunction nes-logical-operators TemporalFrechetDistanceLogicalFunction.cpp) +add_plugin(TemporalGe LogicalFunction nes-logical-operators TemporalGeLogicalFunction.cpp) +add_plugin(TemporalGt LogicalFunction nes-logical-operators TemporalGtLogicalFunction.cpp) +add_plugin(TemporalHausdorffDistance LogicalFunction nes-logical-operators TemporalHausdorffDistanceLogicalFunction.cpp) +add_plugin(TemporalLe LogicalFunction nes-logical-operators TemporalLeLogicalFunction.cpp) +add_plugin(TemporalLt LogicalFunction nes-logical-operators TemporalLtLogicalFunction.cpp) +add_plugin(TemporalNe LogicalFunction nes-logical-operators TemporalNeLogicalFunction.cpp) +add_plugin(TboolToTint LogicalFunction nes-logical-operators TboolToTintLogicalFunction.cpp) +add_plugin(TcbufferToTfloat LogicalFunction nes-logical-operators TcbufferToTfloatLogicalFunction.cpp) +add_plugin(TfloatCeil LogicalFunction nes-logical-operators TfloatCeilLogicalFunction.cpp) +add_plugin(TfloatExp LogicalFunction nes-logical-operators TfloatExpLogicalFunction.cpp) +add_plugin(TfloatFloor LogicalFunction nes-logical-operators TfloatFloorLogicalFunction.cpp) +add_plugin(TfloatLn LogicalFunction nes-logical-operators TfloatLnLogicalFunction.cpp) +add_plugin(TfloatLog10 LogicalFunction nes-logical-operators TfloatLog10LogicalFunction.cpp) +add_plugin(TfloatRadians LogicalFunction nes-logical-operators TfloatRadiansLogicalFunction.cpp) +add_plugin(TfloatToTint LogicalFunction nes-logical-operators TfloatToTintLogicalFunction.cpp) +add_plugin(TintToTfloat LogicalFunction nes-logical-operators TintToTfloatLogicalFunction.cpp) +add_plugin(AdjacentTnumberTbox LogicalFunction nes-logical-operators AdjacentTnumberTboxLogicalFunction.cpp) +add_plugin(AfterTnumberTbox LogicalFunction nes-logical-operators AfterTnumberTboxLogicalFunction.cpp) +add_plugin(BeforeTnumberTbox LogicalFunction nes-logical-operators BeforeTnumberTboxLogicalFunction.cpp) +add_plugin(ContainedTnumberTbox LogicalFunction nes-logical-operators ContainedTnumberTboxLogicalFunction.cpp) +add_plugin(ContainsTnumberTbox LogicalFunction nes-logical-operators ContainsTnumberTboxLogicalFunction.cpp) +add_plugin(LeftTnumberTbox LogicalFunction nes-logical-operators LeftTnumberTboxLogicalFunction.cpp) +add_plugin(NadTcbufferStbox LogicalFunction nes-logical-operators NadTcbufferStboxLogicalFunction.cpp) +add_plugin(NadTfloatTbox LogicalFunction nes-logical-operators NadTfloatTboxLogicalFunction.cpp) +add_plugin(NadTgeoStbox LogicalFunction nes-logical-operators NadTgeoStboxLogicalFunction.cpp) +add_plugin(NadTintTbox LogicalFunction nes-logical-operators NadTintTboxLogicalFunction.cpp) +add_plugin(NadTnpointStbox LogicalFunction nes-logical-operators NadTnpointStboxLogicalFunction.cpp) +add_plugin(NadTposeStbox LogicalFunction nes-logical-operators NadTposeStboxLogicalFunction.cpp) +add_plugin(OverafterTnumberTbox LogicalFunction nes-logical-operators OverafterTnumberTboxLogicalFunction.cpp) +add_plugin(OverbeforeTnumberTbox LogicalFunction nes-logical-operators OverbeforeTnumberTboxLogicalFunction.cpp) +add_plugin(OverlapsTnumberTbox LogicalFunction nes-logical-operators OverlapsTnumberTboxLogicalFunction.cpp) +add_plugin(OverleftTnumberTbox LogicalFunction nes-logical-operators OverleftTnumberTboxLogicalFunction.cpp) +add_plugin(OverrightTnumberTbox LogicalFunction nes-logical-operators OverrightTnumberTboxLogicalFunction.cpp) +add_plugin(RightTnumberTbox LogicalFunction nes-logical-operators RightTnumberTboxLogicalFunction.cpp) +add_plugin(SameTnumberTbox LogicalFunction nes-logical-operators SameTnumberTboxLogicalFunction.cpp) +add_plugin(AboveStboxTspatial LogicalFunction nes-logical-operators AboveStboxTspatialLogicalFunction.cpp) +add_plugin(AboveTspatialStbox LogicalFunction nes-logical-operators AboveTspatialStboxLogicalFunction.cpp) +add_plugin(AdjacentStboxTspatial LogicalFunction nes-logical-operators AdjacentStboxTspatialLogicalFunction.cpp) +add_plugin(AdjacentTboxTnumber LogicalFunction nes-logical-operators AdjacentTboxTnumberLogicalFunction.cpp) +add_plugin(AdjacentTspatialStbox LogicalFunction nes-logical-operators AdjacentTspatialStboxLogicalFunction.cpp) +add_plugin(AfterStboxTspatial LogicalFunction nes-logical-operators AfterStboxTspatialLogicalFunction.cpp) +add_plugin(AfterTboxTnumber LogicalFunction nes-logical-operators AfterTboxTnumberLogicalFunction.cpp) +add_plugin(AfterTspatialStbox LogicalFunction nes-logical-operators AfterTspatialStboxLogicalFunction.cpp) +add_plugin(BackStboxTspatial LogicalFunction nes-logical-operators BackStboxTspatialLogicalFunction.cpp) +add_plugin(BackTspatialStbox LogicalFunction nes-logical-operators BackTspatialStboxLogicalFunction.cpp) +add_plugin(BeforeStboxTspatial LogicalFunction nes-logical-operators BeforeStboxTspatialLogicalFunction.cpp) +add_plugin(BeforeTboxTnumber LogicalFunction nes-logical-operators BeforeTboxTnumberLogicalFunction.cpp) +add_plugin(BeforeTspatialStbox LogicalFunction nes-logical-operators BeforeTspatialStboxLogicalFunction.cpp) +add_plugin(BelowStboxTspatial LogicalFunction nes-logical-operators BelowStboxTspatialLogicalFunction.cpp) +add_plugin(BelowTspatialStbox LogicalFunction nes-logical-operators BelowTspatialStboxLogicalFunction.cpp) +add_plugin(ContainedStboxTspatial LogicalFunction nes-logical-operators ContainedStboxTspatialLogicalFunction.cpp) +add_plugin(ContainedTboxTnumber LogicalFunction nes-logical-operators ContainedTboxTnumberLogicalFunction.cpp) +add_plugin(ContainedTspatialStbox LogicalFunction nes-logical-operators ContainedTspatialStboxLogicalFunction.cpp) +add_plugin(ContainsStboxTspatial LogicalFunction nes-logical-operators ContainsStboxTspatialLogicalFunction.cpp) +add_plugin(ContainsTboxTnumber LogicalFunction nes-logical-operators ContainsTboxTnumberLogicalFunction.cpp) +add_plugin(ContainsTspatialStbox LogicalFunction nes-logical-operators ContainsTspatialStboxLogicalFunction.cpp) +add_plugin(FrontStboxTspatial LogicalFunction nes-logical-operators FrontStboxTspatialLogicalFunction.cpp) +add_plugin(FrontTspatialStbox LogicalFunction nes-logical-operators FrontTspatialStboxLogicalFunction.cpp) +add_plugin(LeftStboxTspatial LogicalFunction nes-logical-operators LeftStboxTspatialLogicalFunction.cpp) +add_plugin(LeftTboxTnumber LogicalFunction nes-logical-operators LeftTboxTnumberLogicalFunction.cpp) +add_plugin(LeftTspatialStbox LogicalFunction nes-logical-operators LeftTspatialStboxLogicalFunction.cpp) +add_plugin(OveraboveStboxTspatial LogicalFunction nes-logical-operators OveraboveStboxTspatialLogicalFunction.cpp) +add_plugin(OveraboveTspatialStbox LogicalFunction nes-logical-operators OveraboveTspatialStboxLogicalFunction.cpp) +add_plugin(OverafterStboxTspatial LogicalFunction nes-logical-operators OverafterStboxTspatialLogicalFunction.cpp) +add_plugin(OverafterTboxTnumber LogicalFunction nes-logical-operators OverafterTboxTnumberLogicalFunction.cpp) +add_plugin(OverafterTspatialStbox LogicalFunction nes-logical-operators OverafterTspatialStboxLogicalFunction.cpp) +add_plugin(OverbackStboxTspatial LogicalFunction nes-logical-operators OverbackStboxTspatialLogicalFunction.cpp) +add_plugin(OverbackTspatialStbox LogicalFunction nes-logical-operators OverbackTspatialStboxLogicalFunction.cpp) +add_plugin(OverbeforeStboxTspatial LogicalFunction nes-logical-operators OverbeforeStboxTspatialLogicalFunction.cpp) +add_plugin(OverbeforeTboxTnumber LogicalFunction nes-logical-operators OverbeforeTboxTnumberLogicalFunction.cpp) +add_plugin(OverbeforeTspatialStbox LogicalFunction nes-logical-operators OverbeforeTspatialStboxLogicalFunction.cpp) +add_plugin(OverbelowStboxTspatial LogicalFunction nes-logical-operators OverbelowStboxTspatialLogicalFunction.cpp) +add_plugin(OverbelowTspatialStbox LogicalFunction nes-logical-operators OverbelowTspatialStboxLogicalFunction.cpp) +add_plugin(OverfrontStboxTspatial LogicalFunction nes-logical-operators OverfrontStboxTspatialLogicalFunction.cpp) +add_plugin(OverfrontTspatialStbox LogicalFunction nes-logical-operators OverfrontTspatialStboxLogicalFunction.cpp) +add_plugin(OverlapsStboxTspatial LogicalFunction nes-logical-operators OverlapsStboxTspatialLogicalFunction.cpp) +add_plugin(OverlapsTboxTnumber LogicalFunction nes-logical-operators OverlapsTboxTnumberLogicalFunction.cpp) +add_plugin(OverlapsTspatialStbox LogicalFunction nes-logical-operators OverlapsTspatialStboxLogicalFunction.cpp) +add_plugin(OverleftStboxTspatial LogicalFunction nes-logical-operators OverleftStboxTspatialLogicalFunction.cpp) +add_plugin(OverleftTboxTnumber LogicalFunction nes-logical-operators OverleftTboxTnumberLogicalFunction.cpp) +add_plugin(OverleftTspatialStbox LogicalFunction nes-logical-operators OverleftTspatialStboxLogicalFunction.cpp) +add_plugin(OverrightStboxTspatial LogicalFunction nes-logical-operators OverrightStboxTspatialLogicalFunction.cpp) +add_plugin(OverrightTboxTnumber LogicalFunction nes-logical-operators OverrightTboxTnumberLogicalFunction.cpp) +add_plugin(OverrightTspatialStbox LogicalFunction nes-logical-operators OverrightTspatialStboxLogicalFunction.cpp) +add_plugin(RightStboxTspatial LogicalFunction nes-logical-operators RightStboxTspatialLogicalFunction.cpp) +add_plugin(RightTboxTnumber LogicalFunction nes-logical-operators RightTboxTnumberLogicalFunction.cpp) +add_plugin(RightTspatialStbox LogicalFunction nes-logical-operators RightTspatialStboxLogicalFunction.cpp) +add_plugin(SameStboxTspatial LogicalFunction nes-logical-operators SameStboxTspatialLogicalFunction.cpp) +add_plugin(SameTboxTnumber LogicalFunction nes-logical-operators SameTboxTnumberLogicalFunction.cpp) +add_plugin(SameTspatialStbox LogicalFunction nes-logical-operators SameTspatialStboxLogicalFunction.cpp) +add_plugin(TpointLengthWkb LogicalFunction nes-logical-operators TpointLengthWkbLogicalFunction.cpp) +add_plugin(AboveStboxStbox LogicalFunction nes-logical-operators AboveStboxStboxLogicalFunction.cpp) +add_plugin(AdjacentStboxStbox LogicalFunction nes-logical-operators AdjacentStboxStboxLogicalFunction.cpp) +add_plugin(AfterStboxStbox LogicalFunction nes-logical-operators AfterStboxStboxLogicalFunction.cpp) +add_plugin(BackStboxStbox LogicalFunction nes-logical-operators BackStboxStboxLogicalFunction.cpp) +add_plugin(BeforeStboxStbox LogicalFunction nes-logical-operators BeforeStboxStboxLogicalFunction.cpp) +add_plugin(BelowStboxStbox LogicalFunction nes-logical-operators BelowStboxStboxLogicalFunction.cpp) +add_plugin(ContainedStboxStbox LogicalFunction nes-logical-operators ContainedStboxStboxLogicalFunction.cpp) +add_plugin(ContainsStboxStbox LogicalFunction nes-logical-operators ContainsStboxStboxLogicalFunction.cpp) +add_plugin(FrontStboxStbox LogicalFunction nes-logical-operators FrontStboxStboxLogicalFunction.cpp) +add_plugin(LeftStboxStbox LogicalFunction nes-logical-operators LeftStboxStboxLogicalFunction.cpp) +add_plugin(NadStboxStbox LogicalFunction nes-logical-operators NadStboxStboxLogicalFunction.cpp) +add_plugin(OveraboveStboxStbox LogicalFunction nes-logical-operators OveraboveStboxStboxLogicalFunction.cpp) +add_plugin(OverafterStboxStbox LogicalFunction nes-logical-operators OverafterStboxStboxLogicalFunction.cpp) +add_plugin(OverbackStboxStbox LogicalFunction nes-logical-operators OverbackStboxStboxLogicalFunction.cpp) +add_plugin(OverbeforeStboxStbox LogicalFunction nes-logical-operators OverbeforeStboxStboxLogicalFunction.cpp) +add_plugin(OverbelowStboxStbox LogicalFunction nes-logical-operators OverbelowStboxStboxLogicalFunction.cpp) +add_plugin(OverfrontStboxStbox LogicalFunction nes-logical-operators OverfrontStboxStboxLogicalFunction.cpp) +add_plugin(OverlapsStboxStbox LogicalFunction nes-logical-operators OverlapsStboxStboxLogicalFunction.cpp) +add_plugin(OverleftStboxStbox LogicalFunction nes-logical-operators OverleftStboxStboxLogicalFunction.cpp) +add_plugin(OverrightStboxStbox LogicalFunction nes-logical-operators OverrightStboxStboxLogicalFunction.cpp) +add_plugin(RightStboxStbox LogicalFunction nes-logical-operators RightStboxStboxLogicalFunction.cpp) +add_plugin(SameStboxStbox LogicalFunction nes-logical-operators SameStboxStboxLogicalFunction.cpp) +add_plugin(StboxCmp LogicalFunction nes-logical-operators StboxCmpLogicalFunction.cpp) +add_plugin(StboxEq LogicalFunction nes-logical-operators StboxEqLogicalFunction.cpp) +add_plugin(StboxGe LogicalFunction nes-logical-operators StboxGeLogicalFunction.cpp) +add_plugin(StboxGt LogicalFunction nes-logical-operators StboxGtLogicalFunction.cpp) +add_plugin(StboxLe LogicalFunction nes-logical-operators StboxLeLogicalFunction.cpp) +add_plugin(StboxLt LogicalFunction nes-logical-operators StboxLtLogicalFunction.cpp) +add_plugin(StboxNe LogicalFunction nes-logical-operators StboxNeLogicalFunction.cpp) +add_plugin(AdjacentTnumberTnumber LogicalFunction nes-logical-operators AdjacentTnumberTnumberLogicalFunction.cpp) +add_plugin(AfterTnumberTnumber LogicalFunction nes-logical-operators AfterTnumberTnumberLogicalFunction.cpp) +add_plugin(BeforeTnumberTnumber LogicalFunction nes-logical-operators BeforeTnumberTnumberLogicalFunction.cpp) +add_plugin(ContainedTnumberTnumber LogicalFunction nes-logical-operators ContainedTnumberTnumberLogicalFunction.cpp) +add_plugin(ContainsTnumberTnumber LogicalFunction nes-logical-operators ContainsTnumberTnumberLogicalFunction.cpp) +add_plugin(LeftTnumberTnumber LogicalFunction nes-logical-operators LeftTnumberTnumberLogicalFunction.cpp) +add_plugin(OverafterTnumberTnumber LogicalFunction nes-logical-operators OverafterTnumberTnumberLogicalFunction.cpp) +add_plugin(OverbeforeTnumberTnumber LogicalFunction nes-logical-operators OverbeforeTnumberTnumberLogicalFunction.cpp) +add_plugin(OverlapsTnumberTnumber LogicalFunction nes-logical-operators OverlapsTnumberTnumberLogicalFunction.cpp) +add_plugin(OverleftTnumberTnumber LogicalFunction nes-logical-operators OverleftTnumberTnumberLogicalFunction.cpp) +add_plugin(OverrightTnumberTnumber LogicalFunction nes-logical-operators OverrightTnumberTnumberLogicalFunction.cpp) +add_plugin(RightTnumberTnumber LogicalFunction nes-logical-operators RightTnumberTnumberLogicalFunction.cpp) +add_plugin(SameTnumberTnumber LogicalFunction nes-logical-operators SameTnumberTnumberLogicalFunction.cpp) diff --git a/nes-logical-operators/src/Functions/Meos/ContainedStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainedStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..7d74a8a002 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainedStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainedStboxStboxLogicalFunction::ContainedStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainedStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainedStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainedStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainedStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "ContainedStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainedStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainedStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainedStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainedStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainedStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainedStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "ContainedStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return ContainedStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainedStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainedStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..9d4bbff8e9 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainedStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainedStboxTspatialLogicalFunction::ContainedStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainedStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainedStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainedStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainedStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "ContainedStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainedStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainedStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainedStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainedStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainedStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainedStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "ContainedStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return ContainedStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainedTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainedTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..5c0d5d337f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainedTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainedTboxTnumberLogicalFunction::ContainedTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainedTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainedTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainedTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainedTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "ContainedTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainedTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainedTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainedTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainedTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainedTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainedTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "ContainedTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return ContainedTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainedTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainedTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..8f9fb965ff --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainedTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainedTemporalTemporalLogicalFunction::ContainedTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType ContainedTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainedTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainedTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainedTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "ContainedTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainedTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainedTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainedTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainedTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainedTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainedTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "ContainedTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return ContainedTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainedTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainedTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..af0131a50c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainedTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainedTnumberTboxLogicalFunction::ContainedTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainedTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainedTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainedTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainedTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "ContainedTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainedTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainedTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainedTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainedTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainedTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainedTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "ContainedTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return ContainedTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainedTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainedTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..da5580a84d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainedTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainedTnumberTnumberLogicalFunction::ContainedTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainedTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainedTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainedTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainedTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "ContainedTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainedTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainedTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainedTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainedTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainedTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainedTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "ContainedTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return ContainedTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainedTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainedTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..8786c954a5 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainedTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainedTspatialStboxLogicalFunction::ContainedTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainedTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainedTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainedTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainedTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "ContainedTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainedTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainedTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainedTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainedTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainedTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainedTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "ContainedTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return ContainedTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainedTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainedTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..4af029dbc7 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainedTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainedTspatialTspatialLogicalFunction::ContainedTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType ContainedTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainedTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainedTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainedTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "ContainedTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainedTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainedTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainedTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainedTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainedTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainedTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "ContainedTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return ContainedTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainsStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainsStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..8a1212bb70 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainsStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainsStboxStboxLogicalFunction::ContainsStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainsStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainsStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainsStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainsStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "ContainsStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainsStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainsStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainsStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainsStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainsStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainsStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "ContainsStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return ContainsStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainsStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainsStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..4700a411bd --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainsStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainsStboxTspatialLogicalFunction::ContainsStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainsStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainsStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainsStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainsStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "ContainsStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainsStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainsStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainsStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainsStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainsStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainsStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "ContainsStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return ContainsStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainsTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainsTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..8ec554ad34 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainsTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainsTboxTnumberLogicalFunction::ContainsTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainsTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainsTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainsTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainsTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "ContainsTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainsTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainsTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainsTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainsTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainsTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainsTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "ContainsTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return ContainsTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainsTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainsTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..ddb2e0c2b5 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainsTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainsTemporalTemporalLogicalFunction::ContainsTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType ContainsTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainsTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainsTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainsTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "ContainsTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainsTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainsTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainsTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainsTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainsTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainsTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "ContainsTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return ContainsTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainsTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainsTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..63767f455c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainsTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainsTnumberTboxLogicalFunction::ContainsTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainsTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainsTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainsTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainsTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "ContainsTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainsTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainsTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainsTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainsTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainsTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainsTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "ContainsTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return ContainsTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainsTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainsTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..e985eb045e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainsTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainsTnumberTnumberLogicalFunction::ContainsTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainsTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainsTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainsTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainsTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "ContainsTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainsTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainsTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainsTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainsTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainsTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainsTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "ContainsTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return ContainsTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainsTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainsTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..ee1f25ce29 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainsTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainsTspatialStboxLogicalFunction::ContainsTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType ContainsTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainsTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainsTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainsTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "ContainsTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainsTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainsTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainsTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainsTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainsTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainsTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "ContainsTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return ContainsTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/ContainsTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/ContainsTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..e7e95b1537 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/ContainsTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +ContainsTspatialTspatialLogicalFunction::ContainsTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType ContainsTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction ContainsTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector ContainsTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction ContainsTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "ContainsTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view ContainsTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool ContainsTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string ContainsTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction ContainsTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction ContainsTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterContainsTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "ContainsTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return ContainsTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EtouchesTpointGeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EtouchesTpointGeoLogicalFunction.cpp new file mode 100644 index 0000000000..12167cc82d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EtouchesTpointGeoLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EtouchesTpointGeoLogicalFunction::EtouchesTpointGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType EtouchesTpointGeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EtouchesTpointGeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EtouchesTpointGeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EtouchesTpointGeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EtouchesTpointGeoLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EtouchesTpointGeoLogicalFunction::getType() const +{ + return NAME; +} + +bool EtouchesTpointGeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EtouchesTpointGeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EtouchesTpointGeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EtouchesTpointGeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEtouchesTpointGeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EtouchesTpointGeoLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EtouchesTpointGeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..c7a7666bcf --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqFloatTfloatLogicalFunction::EverEqFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverEqFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverEqFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverEqFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverEqFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..eac08bd016 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqIntTintLogicalFunction::EverEqIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverEqIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverEqIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverEqIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverEqIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqTboolBoolLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqTboolBoolLogicalFunction.cpp new file mode 100644 index 0000000000..6852f2555c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqTboolBoolLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqTboolBoolLogicalFunction::EverEqTboolBoolLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType EverEqTboolBoolLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqTboolBoolLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqTboolBoolLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqTboolBoolLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverEqTboolBoolLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqTboolBoolLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqTboolBoolLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqTboolBoolLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqTboolBoolLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqTboolBoolLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqTboolBoolLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverEqTboolBoolLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverEqTboolBoolLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqTcbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqTcbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..4ec31f2ec2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqTcbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqTcbufferCbufferLogicalFunction::EverEqTcbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbuffer) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbuffer)); +} + +DataType EverEqTcbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqTcbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqTcbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqTcbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "EverEqTcbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqTcbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqTcbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqTcbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqTcbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqTcbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqTcbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "EverEqTcbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return EverEqTcbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqTcbufferTcbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqTcbufferTcbufferLogicalFunction.cpp new file mode 100644 index 0000000000..7bb52f7c93 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqTcbufferTcbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqTcbufferTcbufferLogicalFunction::EverEqTcbufferTcbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverEqTcbufferTcbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqTcbufferTcbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqTcbufferTcbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqTcbufferTcbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "EverEqTcbufferTcbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqTcbufferTcbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqTcbufferTcbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqTcbufferTcbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqTcbufferTcbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqTcbufferTcbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqTcbufferTcbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "EverEqTcbufferTcbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return EverEqTcbufferTcbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..8862c15299 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqTemporalTemporalLogicalFunction::EverEqTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverEqTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EverEqTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EverEqTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EverEqTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..d7451c6667 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqTfloatFloatLogicalFunction::EverEqTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverEqTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverEqTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverEqTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverEqTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqTgeoGeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqTgeoGeoLogicalFunction.cpp new file mode 100644 index 0000000000..f5df65830b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqTgeoGeoLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqTgeoGeoLogicalFunction::EverEqTgeoGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType EverEqTgeoGeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqTgeoGeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqTgeoGeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqTgeoGeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EverEqTgeoGeoLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqTgeoGeoLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqTgeoGeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqTgeoGeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqTgeoGeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqTgeoGeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqTgeoGeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EverEqTgeoGeoLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EverEqTgeoGeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqTgeoTgeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqTgeoTgeoLogicalFunction.cpp new file mode 100644 index 0000000000..9f6d953b1e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqTgeoTgeoLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqTgeoTgeoLogicalFunction::EverEqTgeoTgeoLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverEqTgeoTgeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqTgeoTgeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqTgeoTgeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqTgeoTgeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "EverEqTgeoTgeoLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqTgeoTgeoLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqTgeoTgeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqTgeoTgeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqTgeoTgeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqTgeoTgeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqTgeoTgeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "EverEqTgeoTgeoLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return EverEqTgeoTgeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverEqTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverEqTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..56771252d4 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverEqTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverEqTintIntLogicalFunction::EverEqTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverEqTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverEqTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverEqTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverEqTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverEqTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverEqTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool EverEqTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverEqTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverEqTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverEqTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverEqTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverEqTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverEqTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGeFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGeFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..85512e3ba3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGeFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGeFloatTfloatLogicalFunction::EverGeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverGeFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGeFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGeFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGeFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverGeFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGeFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGeFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGeFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGeFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGeFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGeFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverGeFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverGeFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGeIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGeIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..dc2850db85 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGeIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGeIntTintLogicalFunction::EverGeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverGeIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGeIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGeIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGeIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverGeIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGeIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGeIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGeIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGeIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGeIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGeIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverGeIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverGeIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGeTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGeTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..aa8247a5d3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGeTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGeTemporalTemporalLogicalFunction::EverGeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverGeTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGeTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGeTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGeTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EverGeTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGeTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGeTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGeTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGeTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGeTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGeTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EverGeTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EverGeTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGeTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGeTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..8c89926fe3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGeTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGeTfloatFloatLogicalFunction::EverGeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverGeTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGeTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGeTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGeTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverGeTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGeTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGeTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGeTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGeTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGeTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGeTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverGeTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverGeTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGeTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGeTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..b1d5de2838 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGeTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGeTintIntLogicalFunction::EverGeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverGeTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGeTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGeTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGeTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverGeTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGeTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGeTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGeTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGeTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGeTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGeTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverGeTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverGeTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGtFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGtFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..a5c2e9e0f2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGtFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGtFloatTfloatLogicalFunction::EverGtFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverGtFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGtFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGtFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGtFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverGtFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGtFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGtFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGtFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGtFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGtFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGtFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverGtFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverGtFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGtIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGtIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..80b4c895c9 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGtIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGtIntTintLogicalFunction::EverGtIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverGtIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGtIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGtIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGtIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverGtIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGtIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGtIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGtIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGtIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGtIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGtIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverGtIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverGtIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGtTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGtTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..d3a30c478a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGtTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGtTemporalTemporalLogicalFunction::EverGtTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverGtTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGtTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGtTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGtTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EverGtTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGtTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGtTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGtTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGtTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGtTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGtTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EverGtTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EverGtTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGtTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGtTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..810c8a6204 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGtTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGtTfloatFloatLogicalFunction::EverGtTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverGtTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGtTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGtTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGtTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverGtTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGtTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGtTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGtTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGtTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGtTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGtTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverGtTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverGtTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverGtTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverGtTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..10fd6065a0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverGtTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverGtTintIntLogicalFunction::EverGtTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverGtTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverGtTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverGtTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverGtTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverGtTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverGtTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool EverGtTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverGtTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverGtTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverGtTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverGtTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverGtTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverGtTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLeFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLeFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..26c86d8f71 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLeFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLeFloatTfloatLogicalFunction::EverLeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverLeFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLeFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLeFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLeFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverLeFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLeFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLeFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLeFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLeFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLeFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLeFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverLeFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverLeFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLeIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLeIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..62567503c0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLeIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLeIntTintLogicalFunction::EverLeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverLeIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLeIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLeIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLeIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverLeIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLeIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLeIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLeIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLeIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLeIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLeIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverLeIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverLeIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLeTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLeTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..a26241a6c8 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLeTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLeTemporalTemporalLogicalFunction::EverLeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverLeTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLeTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLeTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLeTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EverLeTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLeTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLeTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLeTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLeTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLeTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLeTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EverLeTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EverLeTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLeTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLeTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..acfcc6e212 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLeTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLeTfloatFloatLogicalFunction::EverLeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverLeTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLeTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLeTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLeTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverLeTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLeTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLeTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLeTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLeTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLeTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLeTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverLeTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverLeTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLeTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLeTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..0997b531c9 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLeTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLeTintIntLogicalFunction::EverLeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverLeTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLeTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLeTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLeTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverLeTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLeTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLeTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLeTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLeTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLeTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLeTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverLeTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverLeTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLtFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLtFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..1964bb4ed5 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLtFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLtFloatTfloatLogicalFunction::EverLtFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverLtFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLtFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLtFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLtFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverLtFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLtFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLtFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLtFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLtFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLtFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLtFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverLtFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverLtFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLtIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLtIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..dd0f03ae04 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLtIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLtIntTintLogicalFunction::EverLtIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverLtIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLtIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLtIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLtIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverLtIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLtIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLtIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLtIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLtIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLtIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLtIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverLtIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverLtIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLtTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLtTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..154e011b88 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLtTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLtTemporalTemporalLogicalFunction::EverLtTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverLtTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLtTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLtTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLtTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EverLtTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLtTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLtTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLtTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLtTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLtTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLtTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EverLtTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EverLtTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLtTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLtTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..aec6473486 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLtTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLtTfloatFloatLogicalFunction::EverLtTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverLtTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLtTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLtTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLtTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverLtTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLtTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLtTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLtTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLtTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLtTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLtTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverLtTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverLtTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverLtTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverLtTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..fed2977aba --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverLtTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverLtTintIntLogicalFunction::EverLtTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverLtTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverLtTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverLtTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverLtTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverLtTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverLtTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool EverLtTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverLtTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverLtTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverLtTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverLtTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverLtTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverLtTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeFloatTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeFloatTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..960ffb054e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeFloatTfloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeFloatTfloatLogicalFunction::EverNeFloatTfloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverNeFloatTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeFloatTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeFloatTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeFloatTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverNeFloatTfloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeFloatTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeFloatTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeFloatTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeFloatTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeFloatTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeFloatTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverNeFloatTfloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverNeFloatTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeIntTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeIntTintLogicalFunction.cpp new file mode 100644 index 0000000000..055303027f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeIntTintLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeIntTintLogicalFunction::EverNeIntTintLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverNeIntTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeIntTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeIntTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeIntTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverNeIntTintLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeIntTintLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeIntTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeIntTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeIntTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeIntTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeIntTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverNeIntTintLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverNeIntTintLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeTboolBoolLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeTboolBoolLogicalFunction.cpp new file mode 100644 index 0000000000..e7d5566f0d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeTboolBoolLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeTboolBoolLogicalFunction::EverNeTboolBoolLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType EverNeTboolBoolLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeTboolBoolLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeTboolBoolLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeTboolBoolLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverNeTboolBoolLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeTboolBoolLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeTboolBoolLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeTboolBoolLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeTboolBoolLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeTboolBoolLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeTboolBoolLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverNeTboolBoolLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverNeTboolBoolLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeTcbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeTcbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..650c1a7959 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeTcbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeTcbufferCbufferLogicalFunction::EverNeTcbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbuffer) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbuffer)); +} + +DataType EverNeTcbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeTcbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeTcbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeTcbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "EverNeTcbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeTcbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeTcbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeTcbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeTcbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeTcbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeTcbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "EverNeTcbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return EverNeTcbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeTcbufferTcbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeTcbufferTcbufferLogicalFunction.cpp new file mode 100644 index 0000000000..c8803e0ce4 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeTcbufferTcbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeTcbufferTcbufferLogicalFunction::EverNeTcbufferTcbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverNeTcbufferTcbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeTcbufferTcbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeTcbufferTcbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeTcbufferTcbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "EverNeTcbufferTcbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeTcbufferTcbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeTcbufferTcbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeTcbufferTcbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeTcbufferTcbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeTcbufferTcbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeTcbufferTcbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "EverNeTcbufferTcbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return EverNeTcbufferTcbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..bcc51a88d1 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeTemporalTemporalLogicalFunction::EverNeTemporalTemporalLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverNeTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EverNeTemporalTemporalLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EverNeTemporalTemporalLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EverNeTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeTfloatFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeTfloatFloatLogicalFunction.cpp new file mode 100644 index 0000000000..e694b31bc0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeTfloatFloatLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeTfloatFloatLogicalFunction::EverNeTfloatFloatLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverNeTfloatFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeTfloatFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeTfloatFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeTfloatFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverNeTfloatFloatLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeTfloatFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeTfloatFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeTfloatFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeTfloatFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeTfloatFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeTfloatFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverNeTfloatFloatLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverNeTfloatFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeTgeoGeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeTgeoGeoLogicalFunction.cpp new file mode 100644 index 0000000000..d38eadf9ac --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeTgeoGeoLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeTgeoGeoLogicalFunction::EverNeTgeoGeoLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType EverNeTgeoGeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeTgeoGeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeTgeoGeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeTgeoGeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "EverNeTgeoGeoLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeTgeoGeoLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeTgeoGeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeTgeoGeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeTgeoGeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeTgeoGeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeTgeoGeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "EverNeTgeoGeoLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return EverNeTgeoGeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeTgeoTgeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeTgeoTgeoLogicalFunction.cpp new file mode 100644 index 0000000000..ea35026f84 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeTgeoTgeoLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeTgeoTgeoLogicalFunction::EverNeTgeoTgeoLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType EverNeTgeoTgeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeTgeoTgeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeTgeoTgeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeTgeoTgeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "EverNeTgeoTgeoLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeTgeoTgeoLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeTgeoTgeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeTgeoTgeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeTgeoTgeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeTgeoTgeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeTgeoTgeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "EverNeTgeoTgeoLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return EverNeTgeoTgeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/EverNeTintIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/EverNeTintIntLogicalFunction.cpp new file mode 100644 index 0000000000..2d0e30c31c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/EverNeTintIntLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +EverNeTintIntLogicalFunction::EverNeTintIntLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType EverNeTintIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction EverNeTintIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector EverNeTintIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction EverNeTintIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "EverNeTintIntLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view EverNeTintIntLogicalFunction::getType() const +{ + return NAME; +} + +bool EverNeTintIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string EverNeTintIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction EverNeTintIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction EverNeTintIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterEverNeTintIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "EverNeTintIntLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return EverNeTintIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/FrontStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/FrontStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..12bfa01b4d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/FrontStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +FrontStboxStboxLogicalFunction::FrontStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType FrontStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction FrontStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector FrontStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction FrontStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "FrontStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view FrontStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool FrontStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string FrontStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction FrontStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction FrontStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterFrontStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "FrontStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return FrontStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/FrontStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/FrontStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..414fc17f91 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/FrontStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +FrontStboxTspatialLogicalFunction::FrontStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType FrontStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction FrontStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector FrontStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction FrontStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "FrontStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view FrontStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool FrontStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string FrontStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction FrontStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction FrontStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterFrontStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "FrontStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return FrontStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/FrontTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/FrontTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..85632ea099 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/FrontTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +FrontTspatialStboxLogicalFunction::FrontTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType FrontTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction FrontTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector FrontTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction FrontTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "FrontTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view FrontTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool FrontTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string FrontTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction FrontTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction FrontTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterFrontTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "FrontTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return FrontTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/FrontTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/FrontTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..5413d35f48 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/FrontTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +FrontTspatialTspatialLogicalFunction::FrontTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType FrontTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction FrontTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector FrontTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction FrontTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "FrontTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view FrontTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool FrontTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string FrontTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction FrontTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction FrontTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterFrontTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "FrontTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return FrontTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/LeftStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/LeftStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..3897dad876 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/LeftStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +LeftStboxStboxLogicalFunction::LeftStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType LeftStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction LeftStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector LeftStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction LeftStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "LeftStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view LeftStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool LeftStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string LeftStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction LeftStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction LeftStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterLeftStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "LeftStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return LeftStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/LeftStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/LeftStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..5169a926e4 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/LeftStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +LeftStboxTspatialLogicalFunction::LeftStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType LeftStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction LeftStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector LeftStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction LeftStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "LeftStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view LeftStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool LeftStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string LeftStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction LeftStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction LeftStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterLeftStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "LeftStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return LeftStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/LeftTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/LeftTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..3c7c9b4969 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/LeftTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +LeftTboxTnumberLogicalFunction::LeftTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType LeftTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction LeftTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector LeftTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction LeftTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "LeftTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view LeftTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool LeftTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string LeftTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction LeftTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction LeftTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterLeftTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "LeftTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return LeftTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/LeftTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/LeftTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..dde8aa7b5f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/LeftTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +LeftTnumberTboxLogicalFunction::LeftTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType LeftTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction LeftTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector LeftTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction LeftTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "LeftTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view LeftTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool LeftTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string LeftTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction LeftTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction LeftTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterLeftTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "LeftTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return LeftTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/LeftTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/LeftTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..9eef214244 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/LeftTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +LeftTnumberTnumberLogicalFunction::LeftTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType LeftTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction LeftTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector LeftTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction LeftTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "LeftTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view LeftTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool LeftTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string LeftTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction LeftTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction LeftTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterLeftTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "LeftTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return LeftTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/LeftTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/LeftTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..0e4bebab39 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/LeftTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +LeftTspatialStboxLogicalFunction::LeftTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType LeftTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction LeftTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector LeftTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction LeftTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "LeftTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view LeftTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool LeftTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string LeftTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction LeftTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction LeftTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterLeftTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "LeftTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return LeftTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/LeftTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/LeftTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..2d5c977f7a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/LeftTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +LeftTspatialTspatialLogicalFunction::LeftTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType LeftTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction LeftTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector LeftTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction LeftTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "LeftTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view LeftTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool LeftTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string LeftTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction LeftTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction LeftTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterLeftTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "LeftTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return LeftTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..79b246f61b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadStboxStboxLogicalFunction::NadStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType NadStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "NadStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool NadStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "NadStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return NadStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadTcbufferStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadTcbufferStboxLogicalFunction.cpp new file mode 100644 index 0000000000..42189b329b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadTcbufferStboxLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadTcbufferStboxLogicalFunction::NadTcbufferStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType NadTcbufferStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadTcbufferStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadTcbufferStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadTcbufferStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "NadTcbufferStboxLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadTcbufferStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool NadTcbufferStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadTcbufferStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadTcbufferStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadTcbufferStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadTcbufferStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "NadTcbufferStboxLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return NadTcbufferStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadTfloatTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadTfloatTboxLogicalFunction.cpp new file mode 100644 index 0000000000..080e5eca70 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadTfloatTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadTfloatTboxLogicalFunction::NadTfloatTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType NadTfloatTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadTfloatTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadTfloatTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadTfloatTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "NadTfloatTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadTfloatTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool NadTfloatTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadTfloatTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadTfloatTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadTfloatTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadTfloatTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "NadTfloatTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return NadTfloatTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadTgeoStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadTgeoStboxLogicalFunction.cpp new file mode 100644 index 0000000000..e71403f13b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadTgeoStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadTgeoStboxLogicalFunction::NadTgeoStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType NadTgeoStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadTgeoStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadTgeoStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadTgeoStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "NadTgeoStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadTgeoStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool NadTgeoStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadTgeoStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadTgeoStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadTgeoStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadTgeoStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "NadTgeoStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return NadTgeoStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadTintTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadTintTboxLogicalFunction.cpp new file mode 100644 index 0000000000..194326ca4d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadTintTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadTintTboxLogicalFunction::NadTintTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType NadTintTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadTintTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadTintTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadTintTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "NadTintTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadTintTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool NadTintTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadTintTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadTintTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadTintTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadTintTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "NadTintTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return NadTintTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadTnpointGeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadTnpointGeoLogicalFunction.cpp new file mode 100644 index 0000000000..06a925b27e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadTnpointGeoLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadTnpointGeoLogicalFunction::NadTnpointGeoLogicalFunction(LogicalFunction rid, + LogicalFunction frac, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(frac)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType NadTnpointGeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadTnpointGeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadTnpointGeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadTnpointGeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "NadTnpointGeoLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadTnpointGeoLogicalFunction::getType() const +{ + return NAME; +} + +bool NadTnpointGeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadTnpointGeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadTnpointGeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadTnpointGeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadTnpointGeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "NadTnpointGeoLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return NadTnpointGeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadTnpointStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadTnpointStboxLogicalFunction.cpp new file mode 100644 index 0000000000..a99f1c1488 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadTnpointStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadTnpointStboxLogicalFunction::NadTnpointStboxLogicalFunction(LogicalFunction rid, + LogicalFunction frac, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(frac)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType NadTnpointStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadTnpointStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadTnpointStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadTnpointStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "NadTnpointStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadTnpointStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool NadTnpointStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadTnpointStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadTnpointStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadTnpointStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadTnpointStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "NadTnpointStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return NadTnpointStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadTposeGeoLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadTposeGeoLogicalFunction.cpp new file mode 100644 index 0000000000..dc59fdba46 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadTposeGeoLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadTposeGeoLogicalFunction::NadTposeGeoLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType NadTposeGeoLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadTposeGeoLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadTposeGeoLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadTposeGeoLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "NadTposeGeoLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadTposeGeoLogicalFunction::getType() const +{ + return NAME; +} + +bool NadTposeGeoLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadTposeGeoLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadTposeGeoLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadTposeGeoLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadTposeGeoLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "NadTposeGeoLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return NadTposeGeoLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/NadTposeStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/NadTposeStboxLogicalFunction.cpp new file mode 100644 index 0000000000..fcfc4f24b2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/NadTposeStboxLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +NadTposeStboxLogicalFunction::NadTposeStboxLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType NadTposeStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction NadTposeStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector NadTposeStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction NadTposeStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "NadTposeStboxLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view NadTposeStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool NadTposeStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string NadTposeStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction NadTposeStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction NadTposeStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterNadTposeStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "NadTposeStboxLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return NadTposeStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OveraboveStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OveraboveStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..a406566bef --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OveraboveStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OveraboveStboxStboxLogicalFunction::OveraboveStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OveraboveStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OveraboveStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OveraboveStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OveraboveStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OveraboveStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OveraboveStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OveraboveStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OveraboveStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OveraboveStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OveraboveStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOveraboveStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OveraboveStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OveraboveStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OveraboveStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OveraboveStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..fdfdd2eca6 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OveraboveStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OveraboveStboxTspatialLogicalFunction::OveraboveStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OveraboveStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OveraboveStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OveraboveStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OveraboveStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OveraboveStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OveraboveStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OveraboveStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OveraboveStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OveraboveStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OveraboveStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOveraboveStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OveraboveStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OveraboveStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OveraboveTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OveraboveTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..06d46976d0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OveraboveTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OveraboveTspatialStboxLogicalFunction::OveraboveTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OveraboveTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OveraboveTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OveraboveTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OveraboveTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OveraboveTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OveraboveTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OveraboveTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OveraboveTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OveraboveTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OveraboveTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOveraboveTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OveraboveTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OveraboveTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OveraboveTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OveraboveTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..a6549b0179 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OveraboveTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OveraboveTspatialTspatialLogicalFunction::OveraboveTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OveraboveTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OveraboveTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OveraboveTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OveraboveTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OveraboveTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OveraboveTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OveraboveTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OveraboveTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OveraboveTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OveraboveTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOveraboveTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OveraboveTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OveraboveTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverafterStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverafterStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..06e1e095a2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverafterStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverafterStboxStboxLogicalFunction::OverafterStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OverafterStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverafterStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverafterStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverafterStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverafterStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverafterStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverafterStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverafterStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverafterStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverafterStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverafterStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverafterStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverafterStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverafterStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverafterStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..2ca1bd1a7a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverafterStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverafterStboxTspatialLogicalFunction::OverafterStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverafterStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverafterStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverafterStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverafterStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverafterStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverafterStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverafterStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverafterStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverafterStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverafterStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverafterStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverafterStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverafterStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverafterTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverafterTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..6195225670 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverafterTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverafterTboxTnumberLogicalFunction::OverafterTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverafterTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverafterTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverafterTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverafterTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverafterTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverafterTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverafterTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverafterTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverafterTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverafterTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverafterTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverafterTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverafterTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverafterTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverafterTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..2645ba1fee --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverafterTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverafterTemporalTemporalLogicalFunction::OverafterTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverafterTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverafterTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverafterTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverafterTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverafterTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverafterTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool OverafterTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverafterTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverafterTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverafterTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverafterTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverafterTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverafterTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverafterTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverafterTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..a48286ed9e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverafterTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverafterTnumberTboxLogicalFunction::OverafterTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverafterTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverafterTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverafterTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverafterTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverafterTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverafterTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverafterTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverafterTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverafterTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverafterTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverafterTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverafterTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverafterTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverafterTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverafterTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..89c118487e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverafterTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverafterTnumberTnumberLogicalFunction::OverafterTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType OverafterTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverafterTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverafterTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverafterTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverafterTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverafterTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverafterTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverafterTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverafterTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverafterTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverafterTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverafterTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverafterTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverafterTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverafterTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..b916496a1b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverafterTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverafterTspatialStboxLogicalFunction::OverafterTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverafterTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverafterTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverafterTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverafterTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverafterTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverafterTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverafterTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverafterTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverafterTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverafterTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverafterTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverafterTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverafterTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverafterTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverafterTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..0362025f19 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverafterTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverafterTspatialTspatialLogicalFunction::OverafterTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverafterTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverafterTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverafterTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverafterTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverafterTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverafterTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverafterTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverafterTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverafterTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverafterTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverafterTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverafterTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverafterTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbackStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbackStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..d49a472301 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbackStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbackStboxStboxLogicalFunction::OverbackStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbackStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbackStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbackStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbackStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverbackStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbackStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbackStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbackStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbackStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbackStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbackStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverbackStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverbackStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbackStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbackStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..af8289745a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbackStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbackStboxTspatialLogicalFunction::OverbackStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbackStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbackStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbackStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbackStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverbackStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbackStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbackStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbackStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbackStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbackStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbackStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverbackStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverbackStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbackTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbackTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..544750eecb --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbackTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbackTspatialStboxLogicalFunction::OverbackTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbackTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbackTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbackTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbackTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverbackTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbackTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbackTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbackTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbackTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbackTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbackTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverbackTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverbackTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbackTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbackTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..4309d6e20d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbackTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbackTspatialTspatialLogicalFunction::OverbackTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverbackTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbackTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbackTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbackTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverbackTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbackTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbackTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbackTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbackTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbackTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbackTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverbackTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverbackTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbeforeStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbeforeStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..a61cbd1c4e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbeforeStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbeforeStboxStboxLogicalFunction::OverbeforeStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbeforeStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbeforeStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbeforeStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbeforeStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverbeforeStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbeforeStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbeforeStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbeforeStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbeforeStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbeforeStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbeforeStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverbeforeStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverbeforeStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbeforeStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbeforeStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..ad4b87862a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbeforeStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbeforeStboxTspatialLogicalFunction::OverbeforeStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbeforeStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbeforeStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbeforeStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbeforeStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverbeforeStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbeforeStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbeforeStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbeforeStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbeforeStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbeforeStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbeforeStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverbeforeStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverbeforeStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbeforeTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbeforeTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..c2cecc6d7b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbeforeTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbeforeTboxTnumberLogicalFunction::OverbeforeTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbeforeTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbeforeTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbeforeTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbeforeTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverbeforeTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbeforeTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbeforeTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbeforeTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbeforeTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbeforeTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbeforeTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverbeforeTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverbeforeTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbeforeTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbeforeTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..abac6bb1a1 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbeforeTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbeforeTemporalTemporalLogicalFunction::OverbeforeTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverbeforeTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbeforeTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbeforeTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbeforeTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverbeforeTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbeforeTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbeforeTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbeforeTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbeforeTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbeforeTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbeforeTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverbeforeTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverbeforeTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbeforeTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbeforeTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..c8199f41b4 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbeforeTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbeforeTnumberTboxLogicalFunction::OverbeforeTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbeforeTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbeforeTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbeforeTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbeforeTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverbeforeTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbeforeTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbeforeTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbeforeTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbeforeTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbeforeTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbeforeTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverbeforeTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverbeforeTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbeforeTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbeforeTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..240c8e210b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbeforeTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbeforeTnumberTnumberLogicalFunction::OverbeforeTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbeforeTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbeforeTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbeforeTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbeforeTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverbeforeTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbeforeTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbeforeTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbeforeTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbeforeTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbeforeTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbeforeTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverbeforeTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverbeforeTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbeforeTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbeforeTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..c99381f273 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbeforeTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbeforeTspatialStboxLogicalFunction::OverbeforeTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbeforeTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbeforeTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbeforeTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbeforeTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverbeforeTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbeforeTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbeforeTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbeforeTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbeforeTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbeforeTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbeforeTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverbeforeTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverbeforeTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbeforeTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbeforeTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..d0fe838329 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbeforeTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbeforeTspatialTspatialLogicalFunction::OverbeforeTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverbeforeTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbeforeTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbeforeTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbeforeTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverbeforeTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbeforeTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbeforeTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbeforeTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbeforeTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbeforeTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbeforeTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverbeforeTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverbeforeTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbelowStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbelowStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..4c97f75844 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbelowStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbelowStboxStboxLogicalFunction::OverbelowStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbelowStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbelowStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbelowStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbelowStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverbelowStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbelowStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbelowStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbelowStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbelowStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbelowStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbelowStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverbelowStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverbelowStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbelowStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbelowStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..cefa869dc3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbelowStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbelowStboxTspatialLogicalFunction::OverbelowStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbelowStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbelowStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbelowStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbelowStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverbelowStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbelowStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbelowStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbelowStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbelowStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbelowStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbelowStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverbelowStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverbelowStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbelowTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbelowTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..dd0b520dbd --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbelowTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbelowTspatialStboxLogicalFunction::OverbelowTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverbelowTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbelowTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbelowTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbelowTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverbelowTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbelowTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbelowTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbelowTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbelowTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbelowTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbelowTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverbelowTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverbelowTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverbelowTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverbelowTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..307e6b3c43 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverbelowTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverbelowTspatialTspatialLogicalFunction::OverbelowTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverbelowTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverbelowTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverbelowTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverbelowTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverbelowTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverbelowTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverbelowTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverbelowTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverbelowTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverbelowTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverbelowTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverbelowTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverbelowTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverfrontStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverfrontStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..a2c2771e47 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverfrontStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverfrontStboxStboxLogicalFunction::OverfrontStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OverfrontStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverfrontStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverfrontStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverfrontStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverfrontStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverfrontStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverfrontStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverfrontStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverfrontStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverfrontStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverfrontStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverfrontStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverfrontStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverfrontStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverfrontStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..13a056a2f0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverfrontStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverfrontStboxTspatialLogicalFunction::OverfrontStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverfrontStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverfrontStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverfrontStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverfrontStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverfrontStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverfrontStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverfrontStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverfrontStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverfrontStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverfrontStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverfrontStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverfrontStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverfrontStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverfrontTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverfrontTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..599c4e58b1 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverfrontTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverfrontTspatialStboxLogicalFunction::OverfrontTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverfrontTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverfrontTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverfrontTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverfrontTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverfrontTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverfrontTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverfrontTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverfrontTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverfrontTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverfrontTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverfrontTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverfrontTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverfrontTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverfrontTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverfrontTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..7485f1019c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverfrontTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverfrontTspatialTspatialLogicalFunction::OverfrontTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverfrontTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverfrontTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverfrontTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverfrontTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverfrontTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverfrontTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverfrontTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverfrontTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverfrontTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverfrontTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverfrontTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverfrontTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverfrontTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverlapsStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverlapsStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..29c27b424c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverlapsStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverlapsStboxStboxLogicalFunction::OverlapsStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OverlapsStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverlapsStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverlapsStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverlapsStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverlapsStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverlapsStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverlapsStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverlapsStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverlapsStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverlapsStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverlapsStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverlapsStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverlapsStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverlapsStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverlapsStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..2d05aff6bf --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverlapsStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverlapsStboxTspatialLogicalFunction::OverlapsStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverlapsStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverlapsStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverlapsStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverlapsStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverlapsStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverlapsStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverlapsStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverlapsStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverlapsStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverlapsStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverlapsStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverlapsStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverlapsStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverlapsTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverlapsTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..5b417fa4eb --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverlapsTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverlapsTboxTnumberLogicalFunction::OverlapsTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverlapsTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverlapsTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverlapsTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverlapsTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverlapsTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverlapsTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverlapsTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverlapsTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverlapsTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverlapsTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverlapsTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverlapsTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverlapsTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverlapsTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverlapsTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..941eef63ad --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverlapsTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverlapsTemporalTemporalLogicalFunction::OverlapsTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverlapsTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverlapsTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverlapsTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverlapsTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverlapsTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverlapsTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool OverlapsTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverlapsTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverlapsTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverlapsTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverlapsTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverlapsTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverlapsTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverlapsTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverlapsTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..ccbe5f2a1a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverlapsTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverlapsTnumberTboxLogicalFunction::OverlapsTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverlapsTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverlapsTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverlapsTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverlapsTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverlapsTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverlapsTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverlapsTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverlapsTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverlapsTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverlapsTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverlapsTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverlapsTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverlapsTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverlapsTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverlapsTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..4f1e28cb28 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverlapsTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverlapsTnumberTnumberLogicalFunction::OverlapsTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType OverlapsTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverlapsTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverlapsTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverlapsTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverlapsTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverlapsTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverlapsTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverlapsTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverlapsTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverlapsTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverlapsTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverlapsTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverlapsTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverlapsTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverlapsTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..5d1f2cd018 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverlapsTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverlapsTspatialStboxLogicalFunction::OverlapsTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverlapsTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverlapsTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverlapsTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverlapsTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverlapsTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverlapsTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverlapsTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverlapsTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverlapsTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverlapsTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverlapsTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverlapsTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverlapsTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverlapsTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverlapsTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..d64526bfa3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverlapsTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverlapsTspatialTspatialLogicalFunction::OverlapsTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverlapsTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverlapsTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverlapsTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverlapsTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverlapsTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverlapsTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverlapsTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverlapsTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverlapsTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverlapsTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverlapsTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverlapsTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverlapsTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverleftStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverleftStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..57d818313f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverleftStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverleftStboxStboxLogicalFunction::OverleftStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OverleftStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverleftStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverleftStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverleftStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverleftStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverleftStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverleftStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverleftStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverleftStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverleftStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverleftStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverleftStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverleftStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverleftStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverleftStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..a66249e0c2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverleftStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverleftStboxTspatialLogicalFunction::OverleftStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverleftStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverleftStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverleftStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverleftStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverleftStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverleftStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverleftStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverleftStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverleftStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverleftStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverleftStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverleftStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverleftStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverleftTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverleftTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..24495a10b1 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverleftTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverleftTboxTnumberLogicalFunction::OverleftTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverleftTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverleftTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverleftTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverleftTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverleftTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverleftTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverleftTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverleftTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverleftTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverleftTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverleftTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverleftTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverleftTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverleftTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverleftTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..a4e5a8c721 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverleftTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverleftTnumberTboxLogicalFunction::OverleftTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverleftTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverleftTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverleftTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverleftTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverleftTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverleftTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverleftTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverleftTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverleftTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverleftTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverleftTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverleftTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverleftTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverleftTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverleftTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..c7a96d651d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverleftTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverleftTnumberTnumberLogicalFunction::OverleftTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType OverleftTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverleftTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverleftTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverleftTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverleftTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverleftTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverleftTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverleftTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverleftTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverleftTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverleftTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverleftTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverleftTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverleftTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverleftTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..77045eed44 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverleftTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverleftTspatialStboxLogicalFunction::OverleftTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverleftTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverleftTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverleftTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverleftTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverleftTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverleftTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverleftTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverleftTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverleftTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverleftTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverleftTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverleftTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverleftTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverleftTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverleftTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..23991ca362 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverleftTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverleftTspatialTspatialLogicalFunction::OverleftTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverleftTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverleftTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverleftTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverleftTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverleftTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverleftTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverleftTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverleftTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverleftTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverleftTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverleftTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverleftTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverleftTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverrightStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverrightStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..b997f397bf --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverrightStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverrightStboxStboxLogicalFunction::OverrightStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType OverrightStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverrightStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverrightStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverrightStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverrightStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverrightStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverrightStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverrightStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverrightStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverrightStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverrightStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverrightStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverrightStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverrightStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverrightStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..64c35504aa --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverrightStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverrightStboxTspatialLogicalFunction::OverrightStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverrightStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverrightStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverrightStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverrightStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverrightStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverrightStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverrightStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverrightStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverrightStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverrightStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverrightStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverrightStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverrightStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverrightTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverrightTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..ffa4d03bea --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverrightTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverrightTboxTnumberLogicalFunction::OverrightTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverrightTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverrightTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverrightTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverrightTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverrightTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverrightTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverrightTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverrightTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverrightTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverrightTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverrightTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverrightTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverrightTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverrightTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverrightTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..8f4ef848d7 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverrightTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverrightTnumberTboxLogicalFunction::OverrightTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverrightTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverrightTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverrightTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverrightTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "OverrightTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverrightTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverrightTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverrightTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverrightTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverrightTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverrightTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "OverrightTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return OverrightTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverrightTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverrightTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..f77ca02383 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverrightTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverrightTnumberTnumberLogicalFunction::OverrightTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType OverrightTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverrightTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverrightTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverrightTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "OverrightTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverrightTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool OverrightTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverrightTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverrightTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverrightTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverrightTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "OverrightTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return OverrightTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverrightTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverrightTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..2ceecc1a20 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverrightTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverrightTspatialStboxLogicalFunction::OverrightTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType OverrightTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverrightTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverrightTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverrightTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "OverrightTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverrightTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool OverrightTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverrightTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverrightTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverrightTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverrightTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "OverrightTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return OverrightTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/OverrightTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/OverrightTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..5376769087 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/OverrightTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +OverrightTspatialTspatialLogicalFunction::OverrightTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType OverrightTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction OverrightTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector OverrightTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction OverrightTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "OverrightTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view OverrightTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool OverrightTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string OverrightTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction OverrightTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction OverrightTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterOverrightTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "OverrightTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return OverrightTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/RightStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/RightStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..545a6402af --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/RightStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +RightStboxStboxLogicalFunction::RightStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType RightStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction RightStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector RightStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction RightStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "RightStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view RightStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool RightStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string RightStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction RightStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction RightStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterRightStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "RightStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return RightStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/RightStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/RightStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..bf1affcd4f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/RightStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +RightStboxTspatialLogicalFunction::RightStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType RightStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction RightStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector RightStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction RightStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "RightStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view RightStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool RightStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string RightStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction RightStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction RightStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterRightStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "RightStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return RightStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/RightTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/RightTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..1c4d4a20c9 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/RightTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +RightTboxTnumberLogicalFunction::RightTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType RightTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction RightTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector RightTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction RightTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "RightTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view RightTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool RightTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string RightTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction RightTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction RightTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterRightTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "RightTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return RightTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/RightTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/RightTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..4b507b0996 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/RightTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +RightTnumberTboxLogicalFunction::RightTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType RightTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction RightTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector RightTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction RightTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "RightTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view RightTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool RightTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string RightTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction RightTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction RightTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterRightTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "RightTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return RightTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/RightTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/RightTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..8316a4dd01 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/RightTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +RightTnumberTnumberLogicalFunction::RightTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType RightTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction RightTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector RightTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction RightTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "RightTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view RightTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool RightTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string RightTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction RightTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction RightTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterRightTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "RightTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return RightTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/RightTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/RightTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..f9e64f8169 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/RightTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +RightTspatialStboxLogicalFunction::RightTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType RightTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction RightTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector RightTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction RightTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "RightTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view RightTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool RightTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string RightTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction RightTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction RightTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterRightTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "RightTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return RightTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/RightTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/RightTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..a47d9dbf1d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/RightTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +RightTspatialTspatialLogicalFunction::RightTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType RightTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction RightTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector RightTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction RightTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "RightTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view RightTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool RightTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string RightTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction RightTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction RightTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterRightTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "RightTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return RightTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/SameStboxStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/SameStboxStboxLogicalFunction.cpp new file mode 100644 index 0000000000..c6bfbf851a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/SameStboxStboxLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +SameStboxStboxLogicalFunction::SameStboxStboxLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType SameStboxStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction SameStboxStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector SameStboxStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction SameStboxStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "SameStboxStboxLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view SameStboxStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool SameStboxStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string SameStboxStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction SameStboxStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction SameStboxStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterSameStboxStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "SameStboxStboxLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return SameStboxStboxLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/SameStboxTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/SameStboxTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..bb9ec33481 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/SameStboxTspatialLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +SameStboxTspatialLogicalFunction::SameStboxTspatialLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType SameStboxTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction SameStboxTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector SameStboxTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction SameStboxTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "SameStboxTspatialLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view SameStboxTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool SameStboxTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string SameStboxTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction SameStboxTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction SameStboxTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterSameStboxTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "SameStboxTspatialLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return SameStboxTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/SameTboxTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/SameTboxTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..19e075988b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/SameTboxTnumberLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +SameTboxTnumberLogicalFunction::SameTboxTnumberLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType SameTboxTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction SameTboxTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector SameTboxTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction SameTboxTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "SameTboxTnumberLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view SameTboxTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool SameTboxTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string SameTboxTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction SameTboxTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction SameTboxTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterSameTboxTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "SameTboxTnumberLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return SameTboxTnumberLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/SameTemporalTemporalLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/SameTemporalTemporalLogicalFunction.cpp new file mode 100644 index 0000000000..9552000bda --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/SameTemporalTemporalLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +SameTemporalTemporalLogicalFunction::SameTemporalTemporalLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType SameTemporalTemporalLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction SameTemporalTemporalLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector SameTemporalTemporalLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction SameTemporalTemporalLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "SameTemporalTemporalLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view SameTemporalTemporalLogicalFunction::getType() const +{ + return NAME; +} + +bool SameTemporalTemporalLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string SameTemporalTemporalLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction SameTemporalTemporalLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction SameTemporalTemporalLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterSameTemporalTemporalLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "SameTemporalTemporalLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return SameTemporalTemporalLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/SameTnumberTboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/SameTnumberTboxLogicalFunction.cpp new file mode 100644 index 0000000000..dc117980fc --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/SameTnumberTboxLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +SameTnumberTboxLogicalFunction::SameTnumberTboxLogicalFunction(LogicalFunction value, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType SameTnumberTboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction SameTnumberTboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector SameTnumberTboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction SameTnumberTboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "SameTnumberTboxLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view SameTnumberTboxLogicalFunction::getType() const +{ + return NAME; +} + +bool SameTnumberTboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string SameTnumberTboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction SameTnumberTboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction SameTnumberTboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterSameTnumberTboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "SameTnumberTboxLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return SameTnumberTboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/SameTnumberTnumberLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/SameTnumberTnumberLogicalFunction.cpp new file mode 100644 index 0000000000..6329732728 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/SameTnumberTnumberLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +SameTnumberTnumberLogicalFunction::SameTnumberTnumberLogicalFunction(LogicalFunction traj, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(traj)); + parameters.push_back(std::move(arg0)); +} + +DataType SameTnumberTnumberLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction SameTnumberTnumberLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector SameTnumberTnumberLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction SameTnumberTnumberLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "SameTnumberTnumberLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view SameTnumberTnumberLogicalFunction::getType() const +{ + return NAME; +} + +bool SameTnumberTnumberLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string SameTnumberTnumberLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction SameTnumberTnumberLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction SameTnumberTnumberLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterSameTnumberTnumberLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "SameTnumberTnumberLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return SameTnumberTnumberLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/SameTspatialStboxLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/SameTspatialStboxLogicalFunction.cpp new file mode 100644 index 0000000000..ea00d31d74 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/SameTspatialStboxLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +SameTspatialStboxLogicalFunction::SameTspatialStboxLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction ts, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(ts)); + parameters.push_back(std::move(arg0)); +} + +DataType SameTspatialStboxLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction SameTspatialStboxLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector SameTspatialStboxLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction SameTspatialStboxLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "SameTspatialStboxLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view SameTspatialStboxLogicalFunction::getType() const +{ + return NAME; +} + +bool SameTspatialStboxLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string SameTspatialStboxLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction SameTspatialStboxLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction SameTspatialStboxLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterSameTspatialStboxLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "SameTspatialStboxLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return SameTspatialStboxLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/SameTspatialTspatialLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/SameTspatialTspatialLogicalFunction.cpp new file mode 100644 index 0000000000..0cccc4e12e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/SameTspatialTspatialLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +SameTspatialTspatialLogicalFunction::SameTspatialTspatialLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType SameTspatialTspatialLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction SameTspatialTspatialLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector SameTspatialTspatialLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction SameTspatialTspatialLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "SameTspatialTspatialLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view SameTspatialTspatialLogicalFunction::getType() const +{ + return NAME; +} + +bool SameTspatialTspatialLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string SameTspatialTspatialLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction SameTspatialTspatialLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction SameTspatialTspatialLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterSameTspatialTspatialLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "SameTspatialTspatialLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return SameTspatialTspatialLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/StboxCmpLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/StboxCmpLogicalFunction.cpp new file mode 100644 index 0000000000..435795edef --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/StboxCmpLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +StboxCmpLogicalFunction::StboxCmpLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType StboxCmpLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction StboxCmpLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector StboxCmpLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction StboxCmpLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "StboxCmpLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view StboxCmpLogicalFunction::getType() const +{ + return NAME; +} + +bool StboxCmpLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string StboxCmpLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction StboxCmpLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction StboxCmpLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterStboxCmpLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "StboxCmpLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return StboxCmpLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/StboxEqLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/StboxEqLogicalFunction.cpp new file mode 100644 index 0000000000..c53ffd7c36 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/StboxEqLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +StboxEqLogicalFunction::StboxEqLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType StboxEqLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction StboxEqLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector StboxEqLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction StboxEqLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "StboxEqLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view StboxEqLogicalFunction::getType() const +{ + return NAME; +} + +bool StboxEqLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string StboxEqLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction StboxEqLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction StboxEqLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterStboxEqLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "StboxEqLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return StboxEqLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/StboxGeLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/StboxGeLogicalFunction.cpp new file mode 100644 index 0000000000..923a6099cc --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/StboxGeLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +StboxGeLogicalFunction::StboxGeLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType StboxGeLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction StboxGeLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector StboxGeLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction StboxGeLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "StboxGeLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view StboxGeLogicalFunction::getType() const +{ + return NAME; +} + +bool StboxGeLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string StboxGeLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction StboxGeLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction StboxGeLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterStboxGeLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "StboxGeLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return StboxGeLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/StboxGtLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/StboxGtLogicalFunction.cpp new file mode 100644 index 0000000000..c4b43dc4d6 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/StboxGtLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +StboxGtLogicalFunction::StboxGtLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType StboxGtLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction StboxGtLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector StboxGtLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction StboxGtLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "StboxGtLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view StboxGtLogicalFunction::getType() const +{ + return NAME; +} + +bool StboxGtLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string StboxGtLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction StboxGtLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction StboxGtLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterStboxGtLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "StboxGtLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return StboxGtLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/StboxLeLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/StboxLeLogicalFunction.cpp new file mode 100644 index 0000000000..ee7735e706 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/StboxLeLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +StboxLeLogicalFunction::StboxLeLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType StboxLeLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction StboxLeLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector StboxLeLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction StboxLeLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "StboxLeLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view StboxLeLogicalFunction::getType() const +{ + return NAME; +} + +bool StboxLeLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string StboxLeLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction StboxLeLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction StboxLeLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterStboxLeLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "StboxLeLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return StboxLeLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/StboxLtLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/StboxLtLogicalFunction.cpp new file mode 100644 index 0000000000..51c13cdcde --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/StboxLtLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +StboxLtLogicalFunction::StboxLtLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType StboxLtLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction StboxLtLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector StboxLtLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction StboxLtLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "StboxLtLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view StboxLtLogicalFunction::getType() const +{ + return NAME; +} + +bool StboxLtLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string StboxLtLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction StboxLtLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction StboxLtLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterStboxLtLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "StboxLtLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return StboxLtLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/StboxNeLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/StboxNeLogicalFunction.cpp new file mode 100644 index 0000000000..13bbbbd47c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/StboxNeLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +StboxNeLogicalFunction::StboxNeLogicalFunction(LogicalFunction box, + LogicalFunction arg0) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(box)); + parameters.push_back(std::move(arg0)); +} + +DataType StboxNeLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction StboxNeLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector StboxNeLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction StboxNeLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "StboxNeLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view StboxNeLogicalFunction::getType() const +{ + return NAME; +} + +bool StboxNeLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string StboxNeLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction StboxNeLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction StboxNeLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterStboxNeLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "StboxNeLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return StboxNeLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TboolEndValueLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TboolEndValueLogicalFunction.cpp new file mode 100644 index 0000000000..d9e2abb301 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TboolEndValueLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TboolEndValueLogicalFunction::TboolEndValueLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TboolEndValueLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TboolEndValueLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TboolEndValueLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TboolEndValueLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TboolEndValueLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TboolEndValueLogicalFunction::getType() const +{ + return NAME; +} + +bool TboolEndValueLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TboolEndValueLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TboolEndValueLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TboolEndValueLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTboolEndValueLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TboolEndValueLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TboolEndValueLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TboolStartValueLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TboolStartValueLogicalFunction.cpp new file mode 100644 index 0000000000..bbea7e5d52 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TboolStartValueLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TboolStartValueLogicalFunction::TboolStartValueLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TboolStartValueLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TboolStartValueLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TboolStartValueLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TboolStartValueLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TboolStartValueLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TboolStartValueLogicalFunction::getType() const +{ + return NAME; +} + +bool TboolStartValueLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TboolStartValueLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TboolStartValueLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TboolStartValueLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTboolStartValueLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TboolStartValueLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TboolStartValueLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TboolToTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TboolToTintLogicalFunction.cpp new file mode 100644 index 0000000000..e588b4993e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TboolToTintLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TboolToTintLogicalFunction::TboolToTintLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TboolToTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TboolToTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TboolToTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TboolToTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TboolToTintLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TboolToTintLogicalFunction::getType() const +{ + return NAME; +} + +bool TboolToTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TboolToTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TboolToTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TboolToTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTboolToTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TboolToTintLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TboolToTintLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TcbufferToTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TcbufferToTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..931f266d1c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TcbufferToTfloatLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TcbufferToTfloatLogicalFunction::TcbufferToTfloatLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(ts)); +} + +DataType TcbufferToTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TcbufferToTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TcbufferToTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TcbufferToTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TcbufferToTfloatLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TcbufferToTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool TcbufferToTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TcbufferToTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TcbufferToTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TcbufferToTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTcbufferToTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TcbufferToTfloatLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TcbufferToTfloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAContainsGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAContainsGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..9a8c15f5a3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAContainsGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAContainsGeometryLogicalFunction::TemporalAContainsGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalAContainsGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAContainsGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAContainsGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAContainsGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalAContainsGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAContainsGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAContainsGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAContainsGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAContainsGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAContainsGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAContainsGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalAContainsGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalAContainsGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAContainsTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..2da42f0ade --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAContainsTCbufferCbufferLogicalFunction::TemporalAContainsTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalAContainsTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAContainsTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAContainsTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAContainsTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalAContainsTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAContainsTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAContainsTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAContainsTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAContainsTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAContainsTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalAContainsTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalAContainsTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAContainsTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..6f68820e93 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAContainsTCbufferLogicalFunction::TemporalAContainsTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalAContainsTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAContainsTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAContainsTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAContainsTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalAContainsTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAContainsTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAContainsTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAContainsTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAContainsTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAContainsTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalAContainsTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalAContainsTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAContainsTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..4d06e3ee93 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAContainsTGeometryLogicalFunction::TemporalAContainsTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalAContainsTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAContainsTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAContainsTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAContainsTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalAContainsTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAContainsTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAContainsTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAContainsTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAContainsTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAContainsTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalAContainsTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalAContainsTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAContainsTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..dba3ab64a2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAContainsTNpointGeometryLogicalFunction::TemporalAContainsTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalAContainsTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAContainsTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAContainsTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAContainsTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalAContainsTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAContainsTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAContainsTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAContainsTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAContainsTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAContainsTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalAContainsTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalAContainsTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAContainsTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..cdfed10b7b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAContainsTNpointTNpointLogicalFunction::TemporalAContainsTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalAContainsTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAContainsTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAContainsTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAContainsTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalAContainsTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAContainsTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAContainsTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAContainsTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAContainsTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAContainsTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalAContainsTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalAContainsTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAContainsTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..a6f30574fd --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAContainsTPoseGeometryLogicalFunction::TemporalAContainsTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalAContainsTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAContainsTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAContainsTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAContainsTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalAContainsTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAContainsTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAContainsTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAContainsTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAContainsTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAContainsTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalAContainsTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalAContainsTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAContainsTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..5e9e42c95d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAContainsTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAContainsTPoseTPoseLogicalFunction::TemporalAContainsTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalAContainsTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAContainsTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAContainsTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAContainsTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalAContainsTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAContainsTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAContainsTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAContainsTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAContainsTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAContainsTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalAContainsTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalAContainsTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalACoversTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalACoversTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..0d0124fbdc --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalACoversTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalACoversTCbufferCbufferLogicalFunction::TemporalACoversTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalACoversTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalACoversTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalACoversTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalACoversTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalACoversTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalACoversTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalACoversTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalACoversTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalACoversTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalACoversTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalACoversTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalACoversTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalACoversTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalACoversTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalACoversTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..318be3f43f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalACoversTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalACoversTCbufferLogicalFunction::TemporalACoversTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalACoversTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalACoversTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalACoversTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalACoversTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalACoversTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalACoversTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalACoversTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalACoversTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalACoversTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalACoversTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalACoversTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalACoversTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalACoversTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..82cf67f471 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinGeometryLogicalFunction::TemporalADWithinGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalADWithinGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalADWithinGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalADWithinGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..a998242c29 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinTCbufferCbufferLogicalFunction::TemporalADWithinTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalADWithinTCbufferCbufferLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalADWithinTCbufferCbufferLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalADWithinTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..d9845de832 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinTCbufferGeometryLogicalFunction::TemporalADWithinTCbufferGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinTCbufferGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinTCbufferGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinTCbufferGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinTCbufferGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalADWithinTCbufferGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinTCbufferGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinTCbufferGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinTCbufferGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinTCbufferGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinTCbufferGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTCbufferGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalADWithinTCbufferGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalADWithinTCbufferGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..edbe1be762 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,146 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinTCbufferTCbufferLogicalFunction::TemporalADWithinTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(9); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 9, "TemporalADWithinTCbufferTCbufferLogicalFunction requires 9 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 9, + "TemporalADWithinTCbufferTCbufferLogicalFunction requires 9 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + auto arg8 = std::move(arguments.children[8]); + return TemporalADWithinTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7), std::move(arg8)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..52cbdbb012 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTGeometryLogicalFunction.cpp @@ -0,0 +1,140 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinTGeometryLogicalFunction::TemporalADWithinTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(7); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 7, "TemporalADWithinTGeometryLogicalFunction requires 7 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 7, + "TemporalADWithinTGeometryLogicalFunction requires 7 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + return TemporalADWithinTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..9efbfa35f8 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinTNpointGeometryLogicalFunction::TemporalADWithinTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalADWithinTNpointGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalADWithinTNpointGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalADWithinTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..0fdc8260c0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,140 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinTNpointTNpointLogicalFunction::TemporalADWithinTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(7); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 7, "TemporalADWithinTNpointTNpointLogicalFunction requires 7 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 7, + "TemporalADWithinTNpointTNpointLogicalFunction requires 7 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + return TemporalADWithinTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..a6e555655f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinTPoseGeometryLogicalFunction::TemporalADWithinTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalADWithinTPoseGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalADWithinTPoseGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalADWithinTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADWithinTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..2671303591 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADWithinTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,146 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADWithinTPoseTPoseLogicalFunction::TemporalADWithinTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(9); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalADWithinTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADWithinTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADWithinTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADWithinTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 9, "TemporalADWithinTPoseTPoseLogicalFunction requires 9 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADWithinTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADWithinTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADWithinTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADWithinTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADWithinTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 9, + "TemporalADWithinTPoseTPoseLogicalFunction requires 9 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + auto arg8 = std::move(arguments.children[8]); + return TemporalADWithinTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7), std::move(arg8)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..009c4e88fe --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointGeometryLogicalFunction::TemporalADisjointGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalADisjointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalADisjointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalADisjointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalADisjointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..acc246bdd7 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointTCbufferCbufferLogicalFunction::TemporalADisjointTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalADisjointTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalADisjointTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalADisjointTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalADisjointTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..55f4e95f0e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointTCbufferLogicalFunction::TemporalADisjointTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalADisjointTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalADisjointTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalADisjointTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalADisjointTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..8f4ab3c01c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointTCbufferTCbufferLogicalFunction::TemporalADisjointTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalADisjointTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalADisjointTCbufferTCbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalADisjointTCbufferTCbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalADisjointTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..7dddd831d5 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointTGeometryLogicalFunction::TemporalADisjointTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalADisjointTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalADisjointTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalADisjointTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalADisjointTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..5173527fd2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointTNpointGeometryLogicalFunction::TemporalADisjointTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalADisjointTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalADisjointTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalADisjointTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalADisjointTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..ec1295c537 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointTNpointTNpointLogicalFunction::TemporalADisjointTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalADisjointTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalADisjointTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalADisjointTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalADisjointTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..69aed0913d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointTPoseGeometryLogicalFunction::TemporalADisjointTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalADisjointTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalADisjointTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalADisjointTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalADisjointTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalADisjointTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..3b2c24176c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalADisjointTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalADisjointTPoseTPoseLogicalFunction::TemporalADisjointTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalADisjointTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalADisjointTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalADisjointTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalADisjointTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalADisjointTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalADisjointTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalADisjointTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalADisjointTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalADisjointTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalADisjointTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalADisjointTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalADisjointTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..2a03cb7e49 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAIntersectsTCbufferCbufferLogicalFunction::TemporalAIntersectsTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalAIntersectsTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAIntersectsTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAIntersectsTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAIntersectsTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalAIntersectsTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAIntersectsTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAIntersectsTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAIntersectsTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAIntersectsTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAIntersectsTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalAIntersectsTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalAIntersectsTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..b4ecf5418a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAIntersectsTCbufferLogicalFunction::TemporalAIntersectsTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalAIntersectsTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAIntersectsTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAIntersectsTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAIntersectsTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalAIntersectsTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAIntersectsTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAIntersectsTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAIntersectsTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAIntersectsTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAIntersectsTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalAIntersectsTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalAIntersectsTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..03b451f801 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAIntersectsTCbufferTCbufferLogicalFunction::TemporalAIntersectsTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalAIntersectsTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAIntersectsTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAIntersectsTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAIntersectsTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalAIntersectsTCbufferTCbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAIntersectsTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAIntersectsTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAIntersectsTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAIntersectsTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAIntersectsTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalAIntersectsTCbufferTCbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalAIntersectsTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..9b842b294b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAIntersectsTGeometryLogicalFunction::TemporalAIntersectsTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalAIntersectsTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAIntersectsTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAIntersectsTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAIntersectsTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalAIntersectsTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAIntersectsTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAIntersectsTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAIntersectsTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAIntersectsTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAIntersectsTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalAIntersectsTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalAIntersectsTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..80ce0a3854 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAIntersectsTNpointGeometryLogicalFunction::TemporalAIntersectsTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalAIntersectsTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAIntersectsTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAIntersectsTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAIntersectsTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalAIntersectsTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAIntersectsTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAIntersectsTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAIntersectsTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAIntersectsTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAIntersectsTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalAIntersectsTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalAIntersectsTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..a69a301c05 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAIntersectsTNpointTNpointLogicalFunction::TemporalAIntersectsTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalAIntersectsTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAIntersectsTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAIntersectsTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAIntersectsTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalAIntersectsTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAIntersectsTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAIntersectsTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAIntersectsTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAIntersectsTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAIntersectsTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalAIntersectsTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalAIntersectsTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..e152146e01 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAIntersectsTPoseGeometryLogicalFunction::TemporalAIntersectsTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalAIntersectsTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAIntersectsTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAIntersectsTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAIntersectsTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalAIntersectsTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAIntersectsTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAIntersectsTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAIntersectsTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAIntersectsTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAIntersectsTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalAIntersectsTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalAIntersectsTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..c8e82a659f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAIntersectsTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAIntersectsTPoseTPoseLogicalFunction::TemporalAIntersectsTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalAIntersectsTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAIntersectsTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAIntersectsTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAIntersectsTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalAIntersectsTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAIntersectsTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAIntersectsTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAIntersectsTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAIntersectsTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAIntersectsTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalAIntersectsTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalAIntersectsTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..759c8b3f5d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesGeometryLogicalFunction::TemporalATouchesGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalATouchesGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalATouchesGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalATouchesGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalATouchesGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..ec3f86da77 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesTCbufferCbufferLogicalFunction::TemporalATouchesTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalATouchesTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalATouchesTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalATouchesTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalATouchesTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..a36e1aabf2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesTCbufferLogicalFunction::TemporalATouchesTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalATouchesTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalATouchesTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalATouchesTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalATouchesTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..e2603392e2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesTCbufferTCbufferLogicalFunction::TemporalATouchesTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalATouchesTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalATouchesTCbufferTCbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalATouchesTCbufferTCbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalATouchesTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..35ab303505 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesTGeometryLogicalFunction::TemporalATouchesTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalATouchesTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalATouchesTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalATouchesTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalATouchesTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..e0af8cb32e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesTNpointGeometryLogicalFunction::TemporalATouchesTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalATouchesTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalATouchesTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalATouchesTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalATouchesTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..bb7257d12b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesTNpointTNpointLogicalFunction::TemporalATouchesTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalATouchesTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalATouchesTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalATouchesTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalATouchesTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..e3a8a01cb0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesTPoseGeometryLogicalFunction::TemporalATouchesTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalATouchesTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalATouchesTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalATouchesTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalATouchesTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalATouchesTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..9890aa1413 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalATouchesTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalATouchesTPoseTPoseLogicalFunction::TemporalATouchesTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalATouchesTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalATouchesTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalATouchesTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalATouchesTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalATouchesTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalATouchesTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalATouchesTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalATouchesTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalATouchesTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalATouchesTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalATouchesTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalATouchesTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalAtGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalAtGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..78225ad55a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalAtGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalAtGeometryLogicalFunction::TemporalAtGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalAtGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalAtGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalAtGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalAtGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalAtGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalAtGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalAtGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalAtGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalAtGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalAtGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalAtGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalAtGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalAtGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalCmpLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalCmpLogicalFunction.cpp new file mode 100644 index 0000000000..78e90ccdc8 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalCmpLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalCmpLogicalFunction::TemporalCmpLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalCmpLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalCmpLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalCmpLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalCmpLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalCmpLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalCmpLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalCmpLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalCmpLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalCmpLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalCmpLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalCmpLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalCmpLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalCmpLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalDyntimewarpDistanceLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalDyntimewarpDistanceLogicalFunction.cpp new file mode 100644 index 0000000000..427ba9e1f0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalDyntimewarpDistanceLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalDyntimewarpDistanceLogicalFunction::TemporalDyntimewarpDistanceLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalDyntimewarpDistanceLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalDyntimewarpDistanceLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalDyntimewarpDistanceLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalDyntimewarpDistanceLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalDyntimewarpDistanceLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalDyntimewarpDistanceLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalDyntimewarpDistanceLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalDyntimewarpDistanceLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalDyntimewarpDistanceLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalDyntimewarpDistanceLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalDyntimewarpDistanceLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalDyntimewarpDistanceLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalDyntimewarpDistanceLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEContainsTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..751e6d8265 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEContainsTCbufferCbufferLogicalFunction::TemporalEContainsTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalEContainsTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEContainsTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEContainsTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEContainsTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEContainsTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEContainsTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEContainsTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEContainsTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEContainsTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEContainsTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEContainsTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEContainsTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEContainsTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..524a54acc9 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEContainsTCbufferLogicalFunction::TemporalEContainsTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEContainsTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEContainsTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEContainsTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEContainsTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEContainsTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEContainsTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEContainsTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEContainsTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEContainsTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEContainsTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEContainsTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEContainsTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEContainsTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..fd500aa892 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEContainsTGeometryLogicalFunction::TemporalEContainsTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEContainsTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEContainsTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEContainsTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEContainsTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEContainsTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEContainsTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEContainsTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEContainsTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEContainsTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEContainsTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEContainsTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEContainsTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEContainsTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..213e4cb9fa --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEContainsTNpointGeometryLogicalFunction::TemporalEContainsTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEContainsTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEContainsTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEContainsTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEContainsTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalEContainsTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEContainsTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEContainsTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEContainsTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEContainsTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEContainsTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalEContainsTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalEContainsTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEContainsTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..4e1321c7b2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEContainsTNpointTNpointLogicalFunction::TemporalEContainsTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEContainsTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEContainsTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEContainsTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEContainsTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEContainsTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEContainsTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEContainsTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEContainsTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEContainsTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEContainsTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEContainsTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEContainsTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEContainsTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..a8a961578e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEContainsTPoseGeometryLogicalFunction::TemporalEContainsTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEContainsTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEContainsTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEContainsTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEContainsTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEContainsTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEContainsTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEContainsTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEContainsTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEContainsTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEContainsTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEContainsTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEContainsTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEContainsTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..f66a1b707c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEContainsTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEContainsTPoseTPoseLogicalFunction::TemporalEContainsTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEContainsTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEContainsTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEContainsTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEContainsTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalEContainsTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEContainsTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEContainsTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEContainsTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEContainsTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEContainsTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalEContainsTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalEContainsTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..81aa2b3517 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversGeometryLogicalFunction::TemporalECoversGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalECoversGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalECoversGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalECoversGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalECoversGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..597c515778 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversTCbufferCbufferLogicalFunction::TemporalECoversTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalECoversTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalECoversTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalECoversTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalECoversTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..804ae61c1a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversTCbufferLogicalFunction::TemporalECoversTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalECoversTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalECoversTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalECoversTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalECoversTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..af07fbd259 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversTCbufferTCbufferLogicalFunction::TemporalECoversTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalECoversTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalECoversTCbufferTCbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalECoversTCbufferTCbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalECoversTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..403a0ec62c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversTGeometryLogicalFunction::TemporalECoversTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalECoversTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalECoversTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalECoversTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalECoversTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..970db8715f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversTNpointGeometryLogicalFunction::TemporalECoversTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalECoversTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalECoversTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalECoversTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalECoversTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..70503741a2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversTNpointTNpointLogicalFunction::TemporalECoversTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalECoversTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalECoversTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalECoversTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalECoversTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..5b5099171d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversTPoseGeometryLogicalFunction::TemporalECoversTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalECoversTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalECoversTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalECoversTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalECoversTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalECoversTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalECoversTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..a046acb75e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalECoversTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalECoversTPoseTPoseLogicalFunction::TemporalECoversTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalECoversTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalECoversTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalECoversTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalECoversTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalECoversTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalECoversTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalECoversTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalECoversTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalECoversTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalECoversTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalECoversTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalECoversTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalECoversTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..546b40aa37 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDWithinTCbufferCbufferLogicalFunction::TemporalEDWithinTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalEDWithinTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDWithinTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDWithinTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDWithinTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEDWithinTCbufferCbufferLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDWithinTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDWithinTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDWithinTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDWithinTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDWithinTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEDWithinTCbufferCbufferLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEDWithinTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..554a1d78d0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDWithinTCbufferGeometryLogicalFunction::TemporalEDWithinTCbufferGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalEDWithinTCbufferGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDWithinTCbufferGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDWithinTCbufferGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDWithinTCbufferGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEDWithinTCbufferGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDWithinTCbufferGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDWithinTCbufferGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDWithinTCbufferGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDWithinTCbufferGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDWithinTCbufferGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTCbufferGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEDWithinTCbufferGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEDWithinTCbufferGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..8a5a4b2dcc --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,146 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDWithinTCbufferTCbufferLogicalFunction::TemporalEDWithinTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(9); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalEDWithinTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDWithinTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDWithinTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDWithinTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 9, "TemporalEDWithinTCbufferTCbufferLogicalFunction requires 9 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDWithinTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDWithinTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDWithinTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDWithinTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDWithinTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 9, + "TemporalEDWithinTCbufferTCbufferLogicalFunction requires 9 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + auto arg8 = std::move(arguments.children[8]); + return TemporalEDWithinTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7), std::move(arg8)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..9b97bf4afe --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTGeometryLogicalFunction.cpp @@ -0,0 +1,140 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDWithinTGeometryLogicalFunction::TemporalEDWithinTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(7); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalEDWithinTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDWithinTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDWithinTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDWithinTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 7, "TemporalEDWithinTGeometryLogicalFunction requires 7 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDWithinTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDWithinTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDWithinTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDWithinTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDWithinTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 7, + "TemporalEDWithinTGeometryLogicalFunction requires 7 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + return TemporalEDWithinTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..8306e04863 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDWithinTNpointGeometryLogicalFunction::TemporalEDWithinTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalEDWithinTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDWithinTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDWithinTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDWithinTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEDWithinTNpointGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDWithinTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDWithinTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDWithinTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDWithinTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDWithinTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEDWithinTNpointGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEDWithinTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..68a8f03ecb --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,140 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDWithinTNpointTNpointLogicalFunction::TemporalEDWithinTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(7); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalEDWithinTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDWithinTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDWithinTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDWithinTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 7, "TemporalEDWithinTNpointTNpointLogicalFunction requires 7 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDWithinTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDWithinTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDWithinTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDWithinTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDWithinTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 7, + "TemporalEDWithinTNpointTNpointLogicalFunction requires 7 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + return TemporalEDWithinTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..38173e13e2 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDWithinTPoseGeometryLogicalFunction::TemporalEDWithinTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalEDWithinTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDWithinTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDWithinTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDWithinTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEDWithinTPoseGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDWithinTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDWithinTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDWithinTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDWithinTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDWithinTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEDWithinTPoseGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEDWithinTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..0ee9617c1d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDWithinTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,146 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDWithinTPoseTPoseLogicalFunction::TemporalEDWithinTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB, + LogicalFunction dist) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(9); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); + parameters.push_back(std::move(dist)); +} + +DataType TemporalEDWithinTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDWithinTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDWithinTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDWithinTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 9, "TemporalEDWithinTPoseTPoseLogicalFunction requires 9 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDWithinTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDWithinTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDWithinTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDWithinTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDWithinTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 9, + "TemporalEDWithinTPoseTPoseLogicalFunction requires 9 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + auto arg8 = std::move(arguments.children[8]); + return TemporalEDWithinTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7), std::move(arg8)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDisjointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..29e31baade --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDisjointGeometryLogicalFunction::TemporalEDisjointGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEDisjointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDisjointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDisjointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDisjointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalEDisjointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDisjointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDisjointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDisjointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDisjointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDisjointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalEDisjointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalEDisjointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..0fba1df67c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDisjointTCbufferCbufferLogicalFunction::TemporalEDisjointTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalEDisjointTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDisjointTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDisjointTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDisjointTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEDisjointTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDisjointTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDisjointTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDisjointTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDisjointTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDisjointTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEDisjointTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEDisjointTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..e6a286c286 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDisjointTCbufferLogicalFunction::TemporalEDisjointTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEDisjointTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDisjointTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDisjointTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDisjointTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEDisjointTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDisjointTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDisjointTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDisjointTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDisjointTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDisjointTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEDisjointTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEDisjointTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..454a19f2ac --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDisjointTGeometryLogicalFunction::TemporalEDisjointTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEDisjointTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDisjointTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDisjointTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDisjointTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEDisjointTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDisjointTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDisjointTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDisjointTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDisjointTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDisjointTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEDisjointTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEDisjointTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..cbd9b1a6d0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDisjointTNpointGeometryLogicalFunction::TemporalEDisjointTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEDisjointTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDisjointTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDisjointTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDisjointTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalEDisjointTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDisjointTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDisjointTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDisjointTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDisjointTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDisjointTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalEDisjointTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalEDisjointTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..be7e1341a9 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDisjointTNpointTNpointLogicalFunction::TemporalEDisjointTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEDisjointTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDisjointTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDisjointTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDisjointTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEDisjointTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDisjointTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDisjointTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDisjointTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDisjointTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDisjointTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEDisjointTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEDisjointTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..34d0974c49 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDisjointTPoseGeometryLogicalFunction::TemporalEDisjointTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEDisjointTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDisjointTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDisjointTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDisjointTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEDisjointTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDisjointTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDisjointTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDisjointTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDisjointTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDisjointTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEDisjointTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEDisjointTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..4f6d937e17 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEDisjointTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEDisjointTPoseTPoseLogicalFunction::TemporalEDisjointTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEDisjointTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEDisjointTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEDisjointTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEDisjointTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalEDisjointTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEDisjointTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEDisjointTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEDisjointTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEDisjointTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEDisjointTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalEDisjointTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalEDisjointTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..5c9410391a --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsGeometryLogicalFunction::TemporalEIntersectsGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEIntersectsGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalEIntersectsGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalEIntersectsGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalEIntersectsGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..bc74a2ced1 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsTCbufferCbufferLogicalFunction::TemporalEIntersectsTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalEIntersectsTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEIntersectsTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEIntersectsTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEIntersectsTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..24706e36ad --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsTCbufferLogicalFunction::TemporalEIntersectsTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEIntersectsTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEIntersectsTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEIntersectsTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEIntersectsTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..b156bc2db6 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsTCbufferTCbufferLogicalFunction::TemporalEIntersectsTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEIntersectsTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalEIntersectsTCbufferTCbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalEIntersectsTCbufferTCbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalEIntersectsTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..51bdd9f33b --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsTGeometryLogicalFunction::TemporalEIntersectsTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEIntersectsTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEIntersectsTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEIntersectsTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEIntersectsTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..5860977c20 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsTNpointGeometryLogicalFunction::TemporalEIntersectsTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEIntersectsTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalEIntersectsTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalEIntersectsTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalEIntersectsTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..dff7a41b5d --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsTNpointTNpointLogicalFunction::TemporalEIntersectsTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEIntersectsTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEIntersectsTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEIntersectsTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEIntersectsTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..124a9204ac --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsTPoseGeometryLogicalFunction::TemporalEIntersectsTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalEIntersectsTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalEIntersectsTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalEIntersectsTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalEIntersectsTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..75a8a8665c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEIntersectsTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEIntersectsTPoseTPoseLogicalFunction::TemporalEIntersectsTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEIntersectsTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEIntersectsTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEIntersectsTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEIntersectsTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalEIntersectsTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEIntersectsTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEIntersectsTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEIntersectsTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEIntersectsTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEIntersectsTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalEIntersectsTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalEIntersectsTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..fc0fbc2ddd --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesGeometryLogicalFunction::TemporalETouchesGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalETouchesGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalETouchesGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalETouchesGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalETouchesGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..06eaee2b28 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesTCbufferCbufferLogicalFunction::TemporalETouchesTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLit) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLit)); +} + +DataType TemporalETouchesTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalETouchesTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalETouchesTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalETouchesTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..b9d0dda919 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesTCbufferLogicalFunction::TemporalETouchesTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalETouchesTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalETouchesTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalETouchesTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalETouchesTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..e123b01fd8 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesTCbufferTCbufferLogicalFunction::TemporalETouchesTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalETouchesTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalETouchesTCbufferTCbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalETouchesTCbufferTCbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalETouchesTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..ad25f0f20c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesTGeometryLogicalFunction::TemporalETouchesTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalETouchesTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalETouchesTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalETouchesTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalETouchesTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..09821a8cb3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesTNpointGeometryLogicalFunction::TemporalETouchesTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalETouchesTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalETouchesTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalETouchesTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalETouchesTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..b3d8b8c0ba --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesTNpointTNpointLogicalFunction::TemporalETouchesTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalETouchesTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalETouchesTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalETouchesTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalETouchesTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..cf0f71eb87 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesTPoseGeometryLogicalFunction::TemporalETouchesTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalETouchesTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalETouchesTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalETouchesTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalETouchesTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalETouchesTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..9fbc60bb0c --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalETouchesTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalETouchesTPoseTPoseLogicalFunction::TemporalETouchesTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalETouchesTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalETouchesTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalETouchesTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalETouchesTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalETouchesTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalETouchesTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalETouchesTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalETouchesTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalETouchesTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalETouchesTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalETouchesTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalETouchesTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalEqLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalEqLogicalFunction.cpp new file mode 100644 index 0000000000..12e11aac94 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalEqLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalEqLogicalFunction::TemporalEqLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalEqLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalEqLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalEqLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalEqLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalEqLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalEqLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalEqLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalEqLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalEqLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalEqLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalEqLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalEqLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalEqLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalFrechetDistanceLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalFrechetDistanceLogicalFunction.cpp new file mode 100644 index 0000000000..9edc9f393f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalFrechetDistanceLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalFrechetDistanceLogicalFunction::TemporalFrechetDistanceLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalFrechetDistanceLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalFrechetDistanceLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalFrechetDistanceLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalFrechetDistanceLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalFrechetDistanceLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalFrechetDistanceLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalFrechetDistanceLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalFrechetDistanceLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalFrechetDistanceLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalFrechetDistanceLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalFrechetDistanceLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalFrechetDistanceLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalFrechetDistanceLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalGeLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalGeLogicalFunction.cpp new file mode 100644 index 0000000000..2b8c1f0e87 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalGeLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalGeLogicalFunction::TemporalGeLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalGeLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalGeLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalGeLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalGeLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalGeLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalGeLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalGeLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalGeLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalGeLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalGeLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalGeLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalGeLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalGeLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalGtLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalGtLogicalFunction.cpp new file mode 100644 index 0000000000..b6531aee40 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalGtLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalGtLogicalFunction::TemporalGtLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalGtLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalGtLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalGtLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalGtLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalGtLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalGtLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalGtLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalGtLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalGtLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalGtLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalGtLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalGtLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalGtLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalHausdorffDistanceLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalHausdorffDistanceLogicalFunction.cpp new file mode 100644 index 0000000000..4f50681f1f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalHausdorffDistanceLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalHausdorffDistanceLogicalFunction::TemporalHausdorffDistanceLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalHausdorffDistanceLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalHausdorffDistanceLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalHausdorffDistanceLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalHausdorffDistanceLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalHausdorffDistanceLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalHausdorffDistanceLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalHausdorffDistanceLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalHausdorffDistanceLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalHausdorffDistanceLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalHausdorffDistanceLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalHausdorffDistanceLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalHausdorffDistanceLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalHausdorffDistanceLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalLeLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalLeLogicalFunction.cpp new file mode 100644 index 0000000000..ccf8f85bc5 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalLeLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalLeLogicalFunction::TemporalLeLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalLeLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalLeLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalLeLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalLeLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalLeLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalLeLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalLeLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalLeLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalLeLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalLeLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalLeLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalLeLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalLeLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalLtLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalLtLogicalFunction.cpp new file mode 100644 index 0000000000..c9f2dd8f34 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalLtLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalLtLogicalFunction::TemporalLtLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalLtLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalLtLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalLtLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalLtLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalLtLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalLtLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalLtLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalLtLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalLtLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalLtLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalLtLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalLtLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalLtLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalMinusGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalMinusGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..cf8e3098d7 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalMinusGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalMinusGeometryLogicalFunction::TemporalMinusGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalMinusGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalMinusGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalMinusGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalMinusGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalMinusGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalMinusGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalMinusGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalMinusGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalMinusGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalMinusGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalMinusGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalMinusGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalMinusGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADFloatScalarLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADFloatScalarLogicalFunction.cpp new file mode 100644 index 0000000000..31407bf454 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADFloatScalarLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADFloatScalarLogicalFunction::TemporalNADFloatScalarLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType TemporalNADFloatScalarLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADFloatScalarLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADFloatScalarLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADFloatScalarLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "TemporalNADFloatScalarLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADFloatScalarLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADFloatScalarLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADFloatScalarLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADFloatScalarLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADFloatScalarLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADFloatScalarLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "TemporalNADFloatScalarLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return TemporalNADFloatScalarLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..ee72c0f47e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADGeometryLogicalFunction::TemporalNADGeometryLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(4); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalNADGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalNADGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalNADGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalNADGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADIntScalarLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADIntScalarLogicalFunction.cpp new file mode 100644 index 0000000000..b30dfcf072 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADIntScalarLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADIntScalarLogicalFunction::TemporalNADIntScalarLogicalFunction(LogicalFunction value, + LogicalFunction timestamp, + LogicalFunction scalar) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(3); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(scalar)); +} + +DataType TemporalNADIntScalarLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADIntScalarLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADIntScalarLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADIntScalarLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "TemporalNADIntScalarLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADIntScalarLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADIntScalarLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADIntScalarLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADIntScalarLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADIntScalarLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADIntScalarLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "TemporalNADIntScalarLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return TemporalNADIntScalarLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..125285a337 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTCbufferCbufferLogicalFunction::TemporalNADTCbufferCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction cbufferLiteral) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(cbufferLiteral)); +} + +DataType TemporalNADTCbufferCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTCbufferCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTCbufferCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTCbufferCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalNADTCbufferCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTCbufferCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTCbufferCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTCbufferCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTCbufferCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTCbufferCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTCbufferCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalNADTCbufferCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalNADTCbufferCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..bdafea62e3 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTCbufferLogicalFunction::TemporalNADTCbufferLogicalFunction(LogicalFunction lon, + LogicalFunction lat, + LogicalFunction radius, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(5); + parameters.push_back(std::move(lon)); + parameters.push_back(std::move(lat)); + parameters.push_back(std::move(radius)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalNADTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalNADTCbufferLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalNADTCbufferLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalNADTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferTCbufferLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferTCbufferLogicalFunction.cpp new file mode 100644 index 0000000000..fc3ef8e623 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTCbufferTCbufferLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTCbufferTCbufferLogicalFunction::TemporalNADTCbufferTCbufferLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction radiusA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction radiusB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(8); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(radiusA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(radiusB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalNADTCbufferTCbufferLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTCbufferTCbufferLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTCbufferTCbufferLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTCbufferTCbufferLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalNADTCbufferTCbufferLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTCbufferTCbufferLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTCbufferTCbufferLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTCbufferTCbufferLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTCbufferTCbufferLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTCbufferTCbufferLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTCbufferTCbufferLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalNADTCbufferTCbufferLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalNADTCbufferTCbufferLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTFloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTFloatLogicalFunction.cpp new file mode 100644 index 0000000000..6c9340c5ec --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTFloatLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTFloatLogicalFunction::TemporalNADTFloatLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalNADTFloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTFloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTFloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTFloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalNADTFloatLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTFloatLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTFloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTFloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTFloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTFloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTFloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalNADTFloatLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalNADTFloatLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..60ca7071f7 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTGeometryLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTGeometryLogicalFunction::TemporalNADTGeometryLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalNADTGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalNADTGeometryLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalNADTGeometryLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalNADTGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTIntLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTIntLogicalFunction.cpp new file mode 100644 index 0000000000..42d47581e6 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTIntLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTIntLogicalFunction::TemporalNADTIntLogicalFunction(LogicalFunction valueA, + LogicalFunction tsA, + LogicalFunction valueB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(4); + parameters.push_back(std::move(valueA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(valueB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalNADTIntLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTIntLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTIntLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTIntLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalNADTIntLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTIntLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTIntLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTIntLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTIntLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTIntLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTIntLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalNADTIntLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalNADTIntLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTNpointGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTNpointGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..dc09df6d3f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTNpointGeometryLogicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTNpointGeometryLogicalFunction::TemporalNADTNpointGeometryLogicalFunction(LogicalFunction rid, + LogicalFunction fraction, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(4); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(fraction)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalNADTNpointGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTNpointGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTNpointGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTNpointGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 4, "TemporalNADTNpointGeometryLogicalFunction requires 4 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTNpointGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTNpointGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTNpointGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTNpointGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTNpointGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTNpointGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 4, + "TemporalNADTNpointGeometryLogicalFunction requires 4 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + return TemporalNADTNpointGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTNpointTNpointLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTNpointTNpointLogicalFunction.cpp new file mode 100644 index 0000000000..d2e91c4560 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTNpointTNpointLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTNpointTNpointLogicalFunction::TemporalNADTNpointTNpointLogicalFunction(LogicalFunction ridA, + LogicalFunction fractionA, + LogicalFunction tsA, + LogicalFunction ridB, + LogicalFunction fractionB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(6); + parameters.push_back(std::move(ridA)); + parameters.push_back(std::move(fractionA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(ridB)); + parameters.push_back(std::move(fractionB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalNADTNpointTNpointLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTNpointTNpointLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTNpointTNpointLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTNpointTNpointLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalNADTNpointTNpointLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTNpointTNpointLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTNpointTNpointLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTNpointTNpointLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTNpointTNpointLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTNpointTNpointLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTNpointTNpointLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalNADTNpointTNpointLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalNADTNpointTNpointLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTPoseGeometryLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTPoseGeometryLogicalFunction.cpp new file mode 100644 index 0000000000..2749835251 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTPoseGeometryLogicalFunction.cpp @@ -0,0 +1,134 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTPoseGeometryLogicalFunction::TemporalNADTPoseGeometryLogicalFunction(LogicalFunction x, + LogicalFunction y, + LogicalFunction theta, + LogicalFunction timestamp, + LogicalFunction geometry) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(5); + parameters.push_back(std::move(x)); + parameters.push_back(std::move(y)); + parameters.push_back(std::move(theta)); + parameters.push_back(std::move(timestamp)); + parameters.push_back(std::move(geometry)); +} + +DataType TemporalNADTPoseGeometryLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTPoseGeometryLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTPoseGeometryLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTPoseGeometryLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 5, "TemporalNADTPoseGeometryLogicalFunction requires 5 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTPoseGeometryLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTPoseGeometryLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTPoseGeometryLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTPoseGeometryLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTPoseGeometryLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTPoseGeometryLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 5, + "TemporalNADTPoseGeometryLogicalFunction requires 5 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + return TemporalNADTPoseGeometryLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNADTPoseTPoseLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNADTPoseTPoseLogicalFunction.cpp new file mode 100644 index 0000000000..b7a47f6625 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNADTPoseTPoseLogicalFunction.cpp @@ -0,0 +1,143 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNADTPoseTPoseLogicalFunction::TemporalNADTPoseTPoseLogicalFunction(LogicalFunction xA, + LogicalFunction yA, + LogicalFunction thetaA, + LogicalFunction tsA, + LogicalFunction xB, + LogicalFunction yB, + LogicalFunction thetaB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(8); + parameters.push_back(std::move(xA)); + parameters.push_back(std::move(yA)); + parameters.push_back(std::move(thetaA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(xB)); + parameters.push_back(std::move(yB)); + parameters.push_back(std::move(thetaB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalNADTPoseTPoseLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNADTPoseTPoseLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNADTPoseTPoseLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNADTPoseTPoseLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 8, "TemporalNADTPoseTPoseLogicalFunction requires 8 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNADTPoseTPoseLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNADTPoseTPoseLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNADTPoseTPoseLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNADTPoseTPoseLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNADTPoseTPoseLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNADTPoseTPoseLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 8, + "TemporalNADTPoseTPoseLogicalFunction requires 8 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + auto arg6 = std::move(arguments.children[6]); + auto arg7 = std::move(arguments.children[7]); + return TemporalNADTPoseTPoseLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TemporalNeLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TemporalNeLogicalFunction.cpp new file mode 100644 index 0000000000..7091330af1 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TemporalNeLogicalFunction.cpp @@ -0,0 +1,137 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TemporalNeLogicalFunction::TemporalNeLogicalFunction(LogicalFunction lonA, + LogicalFunction latA, + LogicalFunction tsA, + LogicalFunction lonB, + LogicalFunction latB, + LogicalFunction tsB) + : dataType(DataTypeProvider::provideDataType(DataType::Type::BOOLEAN)) +{ + parameters.reserve(6); + parameters.push_back(std::move(lonA)); + parameters.push_back(std::move(latA)); + parameters.push_back(std::move(tsA)); + parameters.push_back(std::move(lonB)); + parameters.push_back(std::move(latB)); + parameters.push_back(std::move(tsB)); +} + +DataType TemporalNeLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TemporalNeLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TemporalNeLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TemporalNeLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 6, "TemporalNeLogicalFunction requires 6 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TemporalNeLogicalFunction::getType() const +{ + return NAME; +} + +bool TemporalNeLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TemporalNeLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TemporalNeLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TemporalNeLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTemporalNeLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 6, + "TemporalNeLogicalFunction requires 6 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + auto arg3 = std::move(arguments.children[3]); + auto arg4 = std::move(arguments.children[4]); + auto arg5 = std::move(arguments.children[5]); + return TemporalNeLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TfloatCeilLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TfloatCeilLogicalFunction.cpp new file mode 100644 index 0000000000..0de1c71bea --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TfloatCeilLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TfloatCeilLogicalFunction::TfloatCeilLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TfloatCeilLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TfloatCeilLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TfloatCeilLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TfloatCeilLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TfloatCeilLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TfloatCeilLogicalFunction::getType() const +{ + return NAME; +} + +bool TfloatCeilLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TfloatCeilLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TfloatCeilLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TfloatCeilLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTfloatCeilLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TfloatCeilLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TfloatCeilLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TfloatExpLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TfloatExpLogicalFunction.cpp new file mode 100644 index 0000000000..33234e797f --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TfloatExpLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TfloatExpLogicalFunction::TfloatExpLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TfloatExpLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TfloatExpLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TfloatExpLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TfloatExpLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TfloatExpLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TfloatExpLogicalFunction::getType() const +{ + return NAME; +} + +bool TfloatExpLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TfloatExpLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TfloatExpLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TfloatExpLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTfloatExpLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TfloatExpLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TfloatExpLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TfloatFloorLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TfloatFloorLogicalFunction.cpp new file mode 100644 index 0000000000..7fe9ee08fc --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TfloatFloorLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TfloatFloorLogicalFunction::TfloatFloorLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TfloatFloorLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TfloatFloorLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TfloatFloorLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TfloatFloorLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TfloatFloorLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TfloatFloorLogicalFunction::getType() const +{ + return NAME; +} + +bool TfloatFloorLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TfloatFloorLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TfloatFloorLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TfloatFloorLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTfloatFloorLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TfloatFloorLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TfloatFloorLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TfloatLnLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TfloatLnLogicalFunction.cpp new file mode 100644 index 0000000000..b07ad8e2d4 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TfloatLnLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TfloatLnLogicalFunction::TfloatLnLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TfloatLnLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TfloatLnLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TfloatLnLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TfloatLnLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TfloatLnLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TfloatLnLogicalFunction::getType() const +{ + return NAME; +} + +bool TfloatLnLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TfloatLnLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TfloatLnLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TfloatLnLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTfloatLnLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TfloatLnLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TfloatLnLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TfloatLog10LogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TfloatLog10LogicalFunction.cpp new file mode 100644 index 0000000000..3e438772be --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TfloatLog10LogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TfloatLog10LogicalFunction::TfloatLog10LogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TfloatLog10LogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TfloatLog10LogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TfloatLog10LogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TfloatLog10LogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TfloatLog10LogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TfloatLog10LogicalFunction::getType() const +{ + return NAME; +} + +bool TfloatLog10LogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TfloatLog10LogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TfloatLog10LogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TfloatLog10LogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTfloatLog10LogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TfloatLog10LogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TfloatLog10LogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TfloatRadiansLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TfloatRadiansLogicalFunction.cpp new file mode 100644 index 0000000000..74d5f2d0cc --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TfloatRadiansLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TfloatRadiansLogicalFunction::TfloatRadiansLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TfloatRadiansLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TfloatRadiansLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TfloatRadiansLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TfloatRadiansLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TfloatRadiansLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TfloatRadiansLogicalFunction::getType() const +{ + return NAME; +} + +bool TfloatRadiansLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TfloatRadiansLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TfloatRadiansLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TfloatRadiansLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTfloatRadiansLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TfloatRadiansLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TfloatRadiansLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TfloatToTintLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TfloatToTintLogicalFunction.cpp new file mode 100644 index 0000000000..a9ac52789e --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TfloatToTintLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TfloatToTintLogicalFunction::TfloatToTintLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::INT32)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TfloatToTintLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TfloatToTintLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TfloatToTintLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TfloatToTintLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TfloatToTintLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TfloatToTintLogicalFunction::getType() const +{ + return NAME; +} + +bool TfloatToTintLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TfloatToTintLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TfloatToTintLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TfloatToTintLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTfloatToTintLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TfloatToTintLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TfloatToTintLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TintToTfloatLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TintToTfloatLogicalFunction.cpp new file mode 100644 index 0000000000..9f6957af15 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TintToTfloatLogicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TintToTfloatLogicalFunction::TintToTfloatLogicalFunction(LogicalFunction value, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(2); + parameters.push_back(std::move(value)); + parameters.push_back(std::move(ts)); +} + +DataType TintToTfloatLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TintToTfloatLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TintToTfloatLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TintToTfloatLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 2, "TintToTfloatLogicalFunction requires 2 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TintToTfloatLogicalFunction::getType() const +{ + return NAME; +} + +bool TintToTfloatLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TintToTfloatLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TintToTfloatLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TintToTfloatLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTintToTfloatLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 2, + "TintToTfloatLogicalFunction requires 2 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + return TintToTfloatLogicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TnpointLengthLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TnpointLengthLogicalFunction.cpp new file mode 100644 index 0000000000..8b425f6b04 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TnpointLengthLogicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TnpointLengthLogicalFunction::TnpointLengthLogicalFunction(LogicalFunction rid, + LogicalFunction frac, + LogicalFunction ts) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(3); + parameters.push_back(std::move(rid)); + parameters.push_back(std::move(frac)); + parameters.push_back(std::move(ts)); +} + +DataType TnpointLengthLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TnpointLengthLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TnpointLengthLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TnpointLengthLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 3, "TnpointLengthLogicalFunction requires 3 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TnpointLengthLogicalFunction::getType() const +{ + return NAME; +} + +bool TnpointLengthLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TnpointLengthLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TnpointLengthLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TnpointLengthLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTnpointLengthLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 3, + "TnpointLengthLogicalFunction requires 3 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + auto arg1 = std::move(arguments.children[1]); + auto arg2 = std::move(arguments.children[2]); + return TnpointLengthLogicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Functions/Meos/TpointLengthWkbLogicalFunction.cpp b/nes-logical-operators/src/Functions/Meos/TpointLengthWkbLogicalFunction.cpp new file mode 100644 index 0000000000..e028c583d0 --- /dev/null +++ b/nes-logical-operators/src/Functions/Meos/TpointLengthWkbLogicalFunction.cpp @@ -0,0 +1,122 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +TpointLengthWkbLogicalFunction::TpointLengthWkbLogicalFunction(LogicalFunction traj) + : dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64)) +{ + parameters.reserve(1); + parameters.push_back(std::move(traj)); +} + +DataType TpointLengthWkbLogicalFunction::getDataType() const +{ + return dataType; +} + +LogicalFunction TpointLengthWkbLogicalFunction::withDataType(const DataType& newDataType) const +{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +} + +std::vector TpointLengthWkbLogicalFunction::getChildren() const +{ + return parameters; +} + +LogicalFunction TpointLengthWkbLogicalFunction::withChildren(const std::vector& children) const +{ + PRECONDITION(children.size() == 1, "TpointLengthWkbLogicalFunction requires 1 children, but got {}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +} + +std::string_view TpointLengthWkbLogicalFunction::getType() const +{ + return NAME; +} + +bool TpointLengthWkbLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{ + if (const auto* other = dynamic_cast(&rhs)) + { + return parameters == other->parameters; + } + return false; +} + +std::string TpointLengthWkbLogicalFunction::explain(ExplainVerbosity verbosity) const +{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + { + if (index > 0) + { + args += ", "; + } + args += parameters[index].explain(verbosity); + } + return fmt::format("{}({})", NAME, args); +} + +LogicalFunction TpointLengthWkbLogicalFunction::withInferredDataType(const Schema& schema) const +{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + { + newChildren.emplace_back(child.withInferredDataType(schema)); + } + return withChildren(newChildren); +} + +SerializableFunction TpointLengthWkbLogicalFunction::serialize() const +{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + { + proto.add_children()->CopyFrom(child.serialize()); + } + return proto; +} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTpointLengthWkbLogicalFunction( + LogicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.children.size() == 1, + "TpointLengthWkbLogicalFunction requires 1 children but got {}", + arguments.children.size()); + auto arg0 = std::move(arguments.children[0]); + return TpointLengthWkbLogicalFunction(std::move(arg0)); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/BigintExtentAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/BigintExtentAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..80f7fb83f1 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/BigintExtentAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +BigintExtentAggregationLogicalFunction::BigintExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +BigintExtentAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view BigintExtentAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void BigintExtentAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("BigintExtentAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction BigintExtentAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterBigintExtentAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "BigintExtentAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/BigintUnionAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/BigintUnionAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..deb306ba0d --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/BigintUnionAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +BigintUnionAggregationLogicalFunction::BigintUnionAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +BigintUnionAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view BigintUnionAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void BigintUnionAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("BigintUnionAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction BigintUnionAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterBigintUnionAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "BigintUnionAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/CMakeLists.txt b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/CMakeLists.txt index 9cdfcdb2dc..6181e40d46 100644 --- a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/CMakeLists.txt +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/CMakeLists.txt @@ -12,3 +12,63 @@ add_plugin(Var AggregationLogicalFunction nes-logical-operators VarAggregationLogicalFunction.cpp) add_plugin(TemporalSequence AggregationLogicalFunction nes-logical-operators TemporalSequenceAggregationLogicalFunctionV2.cpp) +add_plugin(TemporalLength AggregationLogicalFunction nes-logical-operators TemporalLengthAggregationLogicalFunction.cpp) +add_plugin(PairMeeting AggregationLogicalFunction nes-logical-operators PairMeetingAggregationLogicalFunction.cpp) +add_plugin(CrossDistance AggregationLogicalFunction nes-logical-operators CrossDistanceAggregationLogicalFunction.cpp) +add_plugin(TemporalNumInstants AggregationLogicalFunction nes-logical-operators TemporalNumInstantsAggregationLogicalFunction.cpp) +add_plugin(TemporalNumSequences AggregationLogicalFunction nes-logical-operators TemporalNumSequencesAggregationLogicalFunction.cpp) +add_plugin(TemporalNumTimestamps AggregationLogicalFunction nes-logical-operators TemporalNumTimestampsAggregationLogicalFunction.cpp) +add_plugin(TemporalTFloatStartValue AggregationLogicalFunction nes-logical-operators TemporalTFloatStartValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTFloatEndValue AggregationLogicalFunction nes-logical-operators TemporalTFloatEndValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTFloatMinValue AggregationLogicalFunction nes-logical-operators TemporalTFloatMinValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTFloatMaxValue AggregationLogicalFunction nes-logical-operators TemporalTFloatMaxValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTNumberIntegral AggregationLogicalFunction nes-logical-operators TemporalTNumberIntegralAggregationLogicalFunction.cpp) +add_plugin(TemporalTIntStartValue AggregationLogicalFunction nes-logical-operators TemporalTIntStartValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTIntEndValue AggregationLogicalFunction nes-logical-operators TemporalTIntEndValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTIntMinValue AggregationLogicalFunction nes-logical-operators TemporalTIntMinValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTIntMaxValue AggregationLogicalFunction nes-logical-operators TemporalTIntMaxValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTFloatAvgValue AggregationLogicalFunction nes-logical-operators TemporalTFloatAvgValueAggregationLogicalFunction.cpp) +add_plugin(TemporalTNumberTwAvg AggregationLogicalFunction nes-logical-operators TemporalTNumberTwAvgAggregationLogicalFunction.cpp) +add_plugin(TemporalTIntAvgValue AggregationLogicalFunction nes-logical-operators TemporalTIntAvgValueAggregationLogicalFunction.cpp) +add_plugin(TemporalStartTimestamp AggregationLogicalFunction nes-logical-operators TemporalStartTimestampAggregationLogicalFunction.cpp) +add_plugin(TemporalEndTimestamp AggregationLogicalFunction nes-logical-operators TemporalEndTimestampAggregationLogicalFunction.cpp) +add_plugin(TemporalLowerInc AggregationLogicalFunction nes-logical-operators TemporalLowerIncAggregationLogicalFunction.cpp) +add_plugin(TemporalUpperInc AggregationLogicalFunction nes-logical-operators TemporalUpperIncAggregationLogicalFunction.cpp) +add_plugin(TemporalTPointIsSimple AggregationLogicalFunction nes-logical-operators TemporalTPointIsSimpleAggregationLogicalFunction.cpp) +add_plugin(TspatialExtent AggregationLogicalFunction nes-logical-operators TspatialExtentAggregationLogicalFunction.cpp) +add_plugin(TnumberExtent AggregationLogicalFunction nes-logical-operators TnumberExtentAggregationLogicalFunction.cpp) +add_plugin(FloatExtent AggregationLogicalFunction nes-logical-operators FloatExtentAggregationLogicalFunction.cpp) +add_plugin(IntExtent AggregationLogicalFunction nes-logical-operators IntExtentAggregationLogicalFunction.cpp) +add_plugin(BigintExtent AggregationLogicalFunction nes-logical-operators BigintExtentAggregationLogicalFunction.cpp) +add_plugin(TimestamptzExtent AggregationLogicalFunction nes-logical-operators TimestamptzExtentAggregationLogicalFunction.cpp) +add_plugin(FloatUnion AggregationLogicalFunction nes-logical-operators FloatUnionAggregationLogicalFunction.cpp) +add_plugin(IntUnion AggregationLogicalFunction nes-logical-operators IntUnionAggregationLogicalFunction.cpp) +add_plugin(BigintUnion AggregationLogicalFunction nes-logical-operators BigintUnionAggregationLogicalFunction.cpp) +add_plugin(TimestamptzUnion AggregationLogicalFunction nes-logical-operators TimestamptzUnionAggregationLogicalFunction.cpp) +add_plugin(TrajectoryWkb AggregationLogicalFunction nes-logical-operators TrajectoryWkbAggregationLogicalFunction.cpp) +add_plugin(TLengthExp AggregationLogicalFunction nes-logical-operators TLengthExpAggregationLogicalFunction.cpp) +add_plugin(TgeoCentroidExp AggregationLogicalFunction nes-logical-operators TgeoCentroidExpAggregationLogicalFunction.cpp) +add_plugin(TpointAzimuthExp AggregationLogicalFunction nes-logical-operators TpointAzimuthExpAggregationLogicalFunction.cpp) +add_plugin(TpointAngularDifferenceExp AggregationLogicalFunction nes-logical-operators TpointAngularDifferenceExpAggregationLogicalFunction.cpp) +add_plugin(TgeompointToTgeometryExp AggregationLogicalFunction nes-logical-operators TgeompointToTgeometryExpAggregationLogicalFunction.cpp) +add_plugin(TemporalCopyExp AggregationLogicalFunction nes-logical-operators TemporalCopyExpAggregationLogicalFunction.cpp) +add_plugin(TnumberAbsExp AggregationLogicalFunction nes-logical-operators TnumberAbsExpAggregationLogicalFunction.cpp) +add_plugin(TnumberDeltaValueExp AggregationLogicalFunction nes-logical-operators TnumberDeltaValueExpAggregationLogicalFunction.cpp) +add_plugin(TnumberAngularDifferenceExp AggregationLogicalFunction nes-logical-operators TnumberAngularDifferenceExpAggregationLogicalFunction.cpp) +add_plugin(TemporalDerivativeExp AggregationLogicalFunction nes-logical-operators TemporalDerivativeExpAggregationLogicalFunction.cpp) +add_plugin(TemporalAtMaxExp AggregationLogicalFunction nes-logical-operators TemporalAtMaxExpAggregationLogicalFunction.cpp) +add_plugin(TemporalAtMinExp AggregationLogicalFunction nes-logical-operators TemporalAtMinExpAggregationLogicalFunction.cpp) +add_plugin(TemporalMinusMaxExp AggregationLogicalFunction nes-logical-operators TemporalMinusMaxExpAggregationLogicalFunction.cpp) +add_plugin(TemporalMinusMinExp AggregationLogicalFunction nes-logical-operators TemporalMinusMinExpAggregationLogicalFunction.cpp) +add_plugin(TnpointCumulativeLengthExp AggregationLogicalFunction nes-logical-operators TnpointCumulativeLengthExpAggregationLogicalFunction.cpp) +add_plugin(TnpointSpeedExp AggregationLogicalFunction nes-logical-operators TnpointSpeedExpAggregationLogicalFunction.cpp) +add_plugin(TnpointToTgeompointExp AggregationLogicalFunction nes-logical-operators TnpointToTgeompointExpAggregationLogicalFunction.cpp) +add_plugin(TpointCumulativeLengthExp AggregationLogicalFunction nes-logical-operators TpointCumulativeLengthExpAggregationLogicalFunction.cpp) +add_plugin(TpointSpeedExp AggregationLogicalFunction nes-logical-operators TpointSpeedExpAggregationLogicalFunction.cpp) +add_plugin(TpointGetXExp AggregationLogicalFunction nes-logical-operators TpointGetXExpAggregationLogicalFunction.cpp) +add_plugin(TpointGetYExp AggregationLogicalFunction nes-logical-operators TpointGetYExpAggregationLogicalFunction.cpp) +add_plugin(TnumberTrendExp AggregationLogicalFunction nes-logical-operators TnumberTrendExpAggregationLogicalFunction.cpp) +add_plugin(TgeoStartValueExp AggregationLogicalFunction nes-logical-operators TgeoStartValueExpAggregationLogicalFunction.cpp) +add_plugin(TgeoEndValueExp AggregationLogicalFunction nes-logical-operators TgeoEndValueExpAggregationLogicalFunction.cpp) +add_plugin(TgeoConvexHullExp AggregationLogicalFunction nes-logical-operators TgeoConvexHullExpAggregationLogicalFunction.cpp) +add_plugin(TpointTwcentroidExp AggregationLogicalFunction nes-logical-operators TpointTwcentroidExpAggregationLogicalFunction.cpp) diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/CrossDistanceAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/CrossDistanceAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..b92570d6c3 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/CrossDistanceAggregationLogicalFunction.cpp @@ -0,0 +1,157 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +CrossDistanceAggregationLogicalFunction::CrossDistanceAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& vehicleIdField, + const FieldAccessLogicalFunction& asField, + uint64_t vidA, + uint64_t vidB) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) + , vehicleIdField(vehicleIdField) + , vidA(vidA) + , vidB(vidB) +{ +} + +std::shared_ptr +CrossDistanceAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& vehicleIdField, + uint64_t vidA, + uint64_t vidB) +{ + return std::make_shared( + lonField, latField, timestampField, vehicleIdField, lonField, vidA, vidB); +} + +std::string_view CrossDistanceAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void CrossDistanceAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + vehicleIdField = vehicleIdField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() + || !timestampField.getDataType().isNumeric() || !vehicleIdField.getDataType().isNumeric()) + { + throw CannotInferSchema("CrossDistanceAggregationLogicalFunction: lon, lat, timestamp, and vehicle_id fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction CrossDistanceAggregationLogicalFunction::serialize() const +{ + SerializableAggregationFunction saf; + saf.set_type(std::string(NAME)); + + SerializableFunction lonProto; + lonProto.CopyFrom(LogicalFunction(lonField).serialize()); + saf.mutable_on_field()->CopyFrom(lonProto); + + SerializableFunction asProto; + asProto.CopyFrom(LogicalFunction(asField).serialize()); + saf.mutable_as_field()->CopyFrom(asProto); + + SerializableFunction latProto; + latProto.CopyFrom(LogicalFunction(latField).serialize()); + saf.add_extra_fields()->CopyFrom(latProto); + + SerializableFunction tsProto; + tsProto.CopyFrom(LogicalFunction(timestampField).serialize()); + saf.add_extra_fields()->CopyFrom(tsProto); + + SerializableFunction vidProto; + vidProto.CopyFrom(LogicalFunction(vehicleIdField).serialize()); + saf.add_extra_fields()->CopyFrom(vidProto); + + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterCrossDistanceAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 5) + { + // The Registrar only carries the 5 field args (lon, lat, ts, vid, asField) — the + // SerializableAggregationFunction proto does not yet have slots for the (vidA, + // vidB) constants, so the deserialize path reconstructs with the + // BerlinMOD-scaffold defaults. The parser path always supplies explicit values + // from the SQL constant args. Adding (vidA, vidB) to the proto + extending the + // Registrar args struct would close the round-trip gap; tracked as a follow-up + // alongside the matching PairMeeting Serde follow-up (PR #19). + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3], arguments.fields[4], + CrossDistanceAggregationLogicalFunction::DEFAULT_VID_A, + CrossDistanceAggregationLogicalFunction::DEFAULT_VID_B); + return ptr; + } + throw CannotDeserialize( + "CrossDistanceAggregationLogicalFunction requires lon, lat, timestamp, vehicle_id, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/FloatExtentAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/FloatExtentAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..244fcf909f --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/FloatExtentAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +FloatExtentAggregationLogicalFunction::FloatExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +FloatExtentAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view FloatExtentAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void FloatExtentAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("FloatExtentAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction FloatExtentAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterFloatExtentAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "FloatExtentAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/FloatUnionAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/FloatUnionAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..d6e8dad03b --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/FloatUnionAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +FloatUnionAggregationLogicalFunction::FloatUnionAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +FloatUnionAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view FloatUnionAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void FloatUnionAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("FloatUnionAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction FloatUnionAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterFloatUnionAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "FloatUnionAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/IntExtentAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/IntExtentAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..9a8132dfc3 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/IntExtentAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +IntExtentAggregationLogicalFunction::IntExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +IntExtentAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view IntExtentAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void IntExtentAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("IntExtentAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction IntExtentAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterIntExtentAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "IntExtentAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/IntUnionAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/IntUnionAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..2a5cd786af --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/IntUnionAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +IntUnionAggregationLogicalFunction::IntUnionAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +IntUnionAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view IntUnionAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void IntUnionAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("IntUnionAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction IntUnionAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterIntUnionAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "IntUnionAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/PairMeetingAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/PairMeetingAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..d29b898b13 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/PairMeetingAggregationLogicalFunction.cpp @@ -0,0 +1,156 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +PairMeetingAggregationLogicalFunction::PairMeetingAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& vehicleIdField, + const FieldAccessLogicalFunction& asField, + double dMeetMetres) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) + , vehicleIdField(vehicleIdField) + , dMeetMetres(dMeetMetres) +{ +} + +std::shared_ptr +PairMeetingAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& vehicleIdField, + double dMeetMetres) +{ + return std::make_shared( + lonField, latField, timestampField, vehicleIdField, lonField, dMeetMetres); +} + +std::string_view PairMeetingAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void PairMeetingAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + vehicleIdField = vehicleIdField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() + || !timestampField.getDataType().isNumeric() || !vehicleIdField.getDataType().isNumeric()) + { + throw CannotInferSchema("PairMeetingAggregationLogicalFunction: lon, lat, timestamp, and vehicle_id fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction PairMeetingAggregationLogicalFunction::serialize() const +{ + SerializableAggregationFunction saf; + saf.set_type(std::string(NAME)); + + // on_field = lon + SerializableFunction lonProto; + lonProto.CopyFrom(LogicalFunction(lonField).serialize()); + saf.mutable_on_field()->CopyFrom(lonProto); + + // as_field = alias + SerializableFunction asProto; + asProto.CopyFrom(LogicalFunction(asField).serialize()); + saf.mutable_as_field()->CopyFrom(asProto); + + // extra fields = lat, ts, vehicle_id + SerializableFunction latProto; + latProto.CopyFrom(LogicalFunction(latField).serialize()); + saf.add_extra_fields()->CopyFrom(latProto); + + SerializableFunction tsProto; + tsProto.CopyFrom(LogicalFunction(timestampField).serialize()); + saf.add_extra_fields()->CopyFrom(tsProto); + + SerializableFunction vidProto; + vidProto.CopyFrom(LogicalFunction(vehicleIdField).serialize()); + saf.add_extra_fields()->CopyFrom(vidProto); + + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterPairMeetingAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 5) + { + // The Registrar only carries the 5 field args (lon, lat, ts, vid, asField) — the + // SerializableAggregationFunction proto does not yet have a slot for the dMeet + // constant, so the deserialize path reconstructs with the BerlinMOD-scaffold + // default. The parser path always supplies an explicit dMeet from the SQL + // constant arg. Adding dMeet to the proto + extending the Registrar args struct + // would close the round-trip gap; tracked as a follow-up. + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3], arguments.fields[4], + PairMeetingAggregationLogicalFunction::DEFAULT_DMEET_METRES); + return ptr; + } + throw CannotDeserialize( + "PairMeetingAggregationLogicalFunction requires lon, lat, timestamp, vehicle_id, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TLengthExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TLengthExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..f303b2ca82 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TLengthExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TLengthExpAggregationLogicalFunction::TLengthExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TLengthExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TLengthExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TLengthExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TLengthExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TLengthExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTLengthExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TLengthExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalAtMaxExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalAtMaxExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..0d9195121b --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalAtMaxExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalAtMaxExpAggregationLogicalFunction::TemporalAtMaxExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalAtMaxExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalAtMaxExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalAtMaxExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalAtMaxExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalAtMaxExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalAtMaxExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalAtMaxExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalAtMinExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalAtMinExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..5f168f2f7d --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalAtMinExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalAtMinExpAggregationLogicalFunction::TemporalAtMinExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalAtMinExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalAtMinExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalAtMinExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalAtMinExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalAtMinExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalAtMinExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalAtMinExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalCopyExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalCopyExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..fc4ec89edb --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalCopyExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalCopyExpAggregationLogicalFunction::TemporalCopyExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalCopyExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalCopyExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalCopyExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalCopyExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalCopyExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalCopyExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalCopyExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalDerivativeExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalDerivativeExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..5723228d91 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalDerivativeExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalDerivativeExpAggregationLogicalFunction::TemporalDerivativeExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalDerivativeExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalDerivativeExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalDerivativeExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalDerivativeExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalDerivativeExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalDerivativeExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalDerivativeExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalEndTimestampAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalEndTimestampAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..2c7284e4cd --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalEndTimestampAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalEndTimestampAggregationLogicalFunction::TemporalEndTimestampAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalEndTimestampAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalEndTimestampAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalEndTimestampAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalEndTimestampAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalEndTimestampAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalEndTimestampAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalEndTimestampAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalLengthAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalLengthAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..ff46bbc173 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalLengthAggregationLogicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalLengthAggregationLogicalFunction::TemporalLengthAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalLengthAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalLengthAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalLengthAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalLengthAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalLengthAggregationLogicalFunction::serialize() const +{ + // Same wire shape as TemporalSequence (3 fields + alias); only the type tag differs. + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalLengthAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalLengthAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalLowerIncAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalLowerIncAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..a7d2ae1016 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalLowerIncAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalLowerIncAggregationLogicalFunction::TemporalLowerIncAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalLowerIncAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalLowerIncAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalLowerIncAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalLowerIncAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalLowerIncAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalLowerIncAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalLowerIncAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalMinusMaxExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalMinusMaxExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..0ef7076391 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalMinusMaxExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalMinusMaxExpAggregationLogicalFunction::TemporalMinusMaxExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalMinusMaxExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalMinusMaxExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalMinusMaxExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalMinusMaxExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalMinusMaxExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalMinusMaxExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalMinusMaxExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalMinusMinExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalMinusMinExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..64171e7df7 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalMinusMinExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalMinusMinExpAggregationLogicalFunction::TemporalMinusMinExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalMinusMinExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalMinusMinExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalMinusMinExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalMinusMinExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalMinusMinExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalMinusMinExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalMinusMinExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumInstantsAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumInstantsAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..735a6c7cb9 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumInstantsAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalNumInstantsAggregationLogicalFunction::TemporalNumInstantsAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalNumInstantsAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalNumInstantsAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalNumInstantsAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalNumInstantsAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalNumInstantsAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalNumInstantsAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalNumInstantsAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumSequencesAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumSequencesAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..ebcc060442 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumSequencesAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalNumSequencesAggregationLogicalFunction::TemporalNumSequencesAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalNumSequencesAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalNumSequencesAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalNumSequencesAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalNumSequencesAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalNumSequencesAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalNumSequencesAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalNumSequencesAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumTimestampsAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumTimestampsAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..81133034b5 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalNumTimestampsAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalNumTimestampsAggregationLogicalFunction::TemporalNumTimestampsAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalNumTimestampsAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalNumTimestampsAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalNumTimestampsAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalNumTimestampsAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalNumTimestampsAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalNumTimestampsAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalNumTimestampsAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalStartTimestampAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalStartTimestampAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..35ba0bbe90 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalStartTimestampAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalStartTimestampAggregationLogicalFunction::TemporalStartTimestampAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalStartTimestampAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalStartTimestampAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalStartTimestampAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalStartTimestampAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalStartTimestampAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalStartTimestampAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalStartTimestampAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatAvgValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatAvgValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..05f0fea095 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatAvgValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTFloatAvgValueAggregationLogicalFunction::TemporalTFloatAvgValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTFloatAvgValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTFloatAvgValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTFloatAvgValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTFloatAvgValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTFloatAvgValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTFloatAvgValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTFloatAvgValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatEndValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatEndValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..5eb843909b --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatEndValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTFloatEndValueAggregationLogicalFunction::TemporalTFloatEndValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTFloatEndValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTFloatEndValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTFloatEndValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTFloatEndValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTFloatEndValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTFloatEndValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTFloatEndValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatMaxValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatMaxValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..70590f6c7e --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatMaxValueAggregationLogicalFunction.cpp @@ -0,0 +1,123 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTFloatMaxValueAggregationLogicalFunction::TemporalTFloatMaxValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTFloatMaxValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTFloatMaxValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTFloatMaxValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTFloatMaxValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTFloatMaxValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTFloatMaxValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serialize() uses the 4-field TemporalSequence serde with value duplicated: + // parse returns [value, timestamp, value, alias], so alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTFloatMaxValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatMinValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatMinValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..9ca7242316 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatMinValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTFloatMinValueAggregationLogicalFunction::TemporalTFloatMinValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTFloatMinValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTFloatMinValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTFloatMinValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTFloatMinValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTFloatMinValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTFloatMinValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTFloatMinValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatStartValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatStartValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..f9fff79224 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTFloatStartValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTFloatStartValueAggregationLogicalFunction::TemporalTFloatStartValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTFloatStartValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTFloatStartValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTFloatStartValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTFloatStartValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTFloatStartValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTFloatStartValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTFloatStartValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntAvgValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntAvgValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..d2c593c758 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntAvgValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTIntAvgValueAggregationLogicalFunction::TemporalTIntAvgValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTIntAvgValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTIntAvgValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTIntAvgValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTIntAvgValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTIntAvgValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTIntAvgValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTIntAvgValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntEndValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntEndValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..4dec9753d2 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntEndValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTIntEndValueAggregationLogicalFunction::TemporalTIntEndValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTIntEndValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTIntEndValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTIntEndValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTIntEndValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTIntEndValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTIntEndValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTIntEndValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntMaxValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntMaxValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..8f68f69a5b --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntMaxValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTIntMaxValueAggregationLogicalFunction::TemporalTIntMaxValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTIntMaxValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTIntMaxValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTIntMaxValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTIntMaxValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTIntMaxValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTIntMaxValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTIntMaxValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntMinValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntMinValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..e47d9c7f16 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntMinValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTIntMinValueAggregationLogicalFunction::TemporalTIntMinValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTIntMinValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTIntMinValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTIntMinValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTIntMinValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTIntMinValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTIntMinValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTIntMinValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntStartValueAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntStartValueAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..87d394eea3 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTIntStartValueAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTIntStartValueAggregationLogicalFunction::TemporalTIntStartValueAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTIntStartValueAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTIntStartValueAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTIntStartValueAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTIntStartValueAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTIntStartValueAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTIntStartValueAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTIntStartValueAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTNumberIntegralAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTNumberIntegralAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..238adc5005 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTNumberIntegralAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTNumberIntegralAggregationLogicalFunction::TemporalTNumberIntegralAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTNumberIntegralAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTNumberIntegralAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTNumberIntegralAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTNumberIntegralAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTNumberIntegralAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTNumberIntegralAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTNumberIntegralAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTNumberTwAvgAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTNumberTwAvgAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..8c73f30743 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTNumberTwAvgAggregationLogicalFunction.cpp @@ -0,0 +1,123 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTNumberTwAvgAggregationLogicalFunction::TemporalTNumberTwAvgAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTNumberTwAvgAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TemporalTNumberTwAvgAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTNumberTwAvgAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTNumberTwAvgAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTNumberTwAvgAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTNumberTwAvgAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serialize() uses the 4-field TemporalSequence serde with value duplicated: + // parse returns [value, timestamp, value, alias], so alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTNumberTwAvgAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTPointIsSimpleAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTPointIsSimpleAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..051a94fd2e --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalTPointIsSimpleAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalTPointIsSimpleAggregationLogicalFunction::TemporalTPointIsSimpleAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalTPointIsSimpleAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalTPointIsSimpleAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalTPointIsSimpleAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalTPointIsSimpleAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalTPointIsSimpleAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalTPointIsSimpleAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalTPointIsSimpleAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalUpperIncAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalUpperIncAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..ef954c21bf --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TemporalUpperIncAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TemporalUpperIncAggregationLogicalFunction::TemporalUpperIncAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TemporalUpperIncAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TemporalUpperIncAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TemporalUpperIncAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TemporalUpperIncAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TemporalUpperIncAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTemporalUpperIncAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TemporalUpperIncAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoCentroidExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoCentroidExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..371c2d426f --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoCentroidExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TgeoCentroidExpAggregationLogicalFunction::TgeoCentroidExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TgeoCentroidExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TgeoCentroidExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TgeoCentroidExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TgeoCentroidExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TgeoCentroidExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTgeoCentroidExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TgeoCentroidExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoConvexHullExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoConvexHullExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..464c656692 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoConvexHullExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TgeoConvexHullExpAggregationLogicalFunction::TgeoConvexHullExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TgeoConvexHullExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TgeoConvexHullExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TgeoConvexHullExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TgeoConvexHullExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TgeoConvexHullExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTgeoConvexHullExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TgeoConvexHullExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoEndValueExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoEndValueExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..63ede15617 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoEndValueExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TgeoEndValueExpAggregationLogicalFunction::TgeoEndValueExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TgeoEndValueExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TgeoEndValueExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TgeoEndValueExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TgeoEndValueExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TgeoEndValueExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTgeoEndValueExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TgeoEndValueExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoStartValueExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoStartValueExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..ae1916c3cd --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeoStartValueExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TgeoStartValueExpAggregationLogicalFunction::TgeoStartValueExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TgeoStartValueExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TgeoStartValueExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TgeoStartValueExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TgeoStartValueExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TgeoStartValueExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTgeoStartValueExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TgeoStartValueExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeompointToTgeometryExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeompointToTgeometryExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..d8dac62f31 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TgeompointToTgeometryExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TgeompointToTgeometryExpAggregationLogicalFunction::TgeompointToTgeometryExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TgeompointToTgeometryExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TgeompointToTgeometryExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TgeompointToTgeometryExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TgeompointToTgeometryExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TgeompointToTgeometryExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTgeompointToTgeometryExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TgeompointToTgeometryExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TimestamptzExtentAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TimestamptzExtentAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..f76f3cd205 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TimestamptzExtentAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TimestamptzExtentAggregationLogicalFunction::TimestamptzExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TimestamptzExtentAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TimestamptzExtentAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TimestamptzExtentAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TimestamptzExtentAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TimestamptzExtentAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTimestamptzExtentAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TimestamptzExtentAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TimestamptzUnionAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TimestamptzUnionAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..800a6e13c5 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TimestamptzUnionAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TimestamptzUnionAggregationLogicalFunction::TimestamptzUnionAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TimestamptzUnionAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TimestamptzUnionAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TimestamptzUnionAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TimestamptzUnionAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TimestamptzUnionAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTimestamptzUnionAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TimestamptzUnionAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointCumulativeLengthExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointCumulativeLengthExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..561f6ee97a --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointCumulativeLengthExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TnpointCumulativeLengthExpAggregationLogicalFunction::TnpointCumulativeLengthExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TnpointCumulativeLengthExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TnpointCumulativeLengthExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TnpointCumulativeLengthExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TnpointCumulativeLengthExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TnpointCumulativeLengthExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTnpointCumulativeLengthExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TnpointCumulativeLengthExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointSpeedExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointSpeedExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..c39edee5db --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointSpeedExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TnpointSpeedExpAggregationLogicalFunction::TnpointSpeedExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TnpointSpeedExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TnpointSpeedExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TnpointSpeedExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TnpointSpeedExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TnpointSpeedExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTnpointSpeedExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TnpointSpeedExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointToTgeompointExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointToTgeompointExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..861270f55e --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnpointToTgeompointExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TnpointToTgeompointExpAggregationLogicalFunction::TnpointToTgeompointExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TnpointToTgeompointExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TnpointToTgeompointExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TnpointToTgeompointExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TnpointToTgeompointExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TnpointToTgeompointExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTnpointToTgeompointExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TnpointToTgeompointExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberAbsExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberAbsExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..01da27a1ab --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberAbsExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TnumberAbsExpAggregationLogicalFunction::TnumberAbsExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TnumberAbsExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TnumberAbsExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TnumberAbsExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TnumberAbsExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TnumberAbsExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTnumberAbsExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TnumberAbsExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberAngularDifferenceExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberAngularDifferenceExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..627aa6accd --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberAngularDifferenceExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TnumberAngularDifferenceExpAggregationLogicalFunction::TnumberAngularDifferenceExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TnumberAngularDifferenceExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TnumberAngularDifferenceExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TnumberAngularDifferenceExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TnumberAngularDifferenceExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TnumberAngularDifferenceExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTnumberAngularDifferenceExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TnumberAngularDifferenceExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberDeltaValueExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberDeltaValueExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..03308aec57 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberDeltaValueExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TnumberDeltaValueExpAggregationLogicalFunction::TnumberDeltaValueExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TnumberDeltaValueExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TnumberDeltaValueExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TnumberDeltaValueExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TnumberDeltaValueExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TnumberDeltaValueExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTnumberDeltaValueExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TnumberDeltaValueExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberExtentAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberExtentAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..a935304e5c --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberExtentAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TnumberExtentAggregationLogicalFunction::TnumberExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TnumberExtentAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TnumberExtentAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TnumberExtentAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TnumberExtentAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TnumberExtentAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTnumberExtentAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TnumberExtentAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberTrendExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberTrendExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..3c56047aae --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TnumberTrendExpAggregationLogicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TnumberTrendExpAggregationLogicalFunction::TnumberTrendExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TnumberTrendExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(valueField, timestampField, valueField); +} + +std::string_view TnumberTrendExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TnumberTrendExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TnumberTrendExpAggregationLogicalFunction: value and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TnumberTrendExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTnumberTrendExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TnumberTrendExpAggregationLogicalFunction requires value, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointAngularDifferenceExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointAngularDifferenceExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..bd323cc4bc --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointAngularDifferenceExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TpointAngularDifferenceExpAggregationLogicalFunction::TpointAngularDifferenceExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TpointAngularDifferenceExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TpointAngularDifferenceExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TpointAngularDifferenceExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TpointAngularDifferenceExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TpointAngularDifferenceExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTpointAngularDifferenceExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TpointAngularDifferenceExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointAzimuthExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointAzimuthExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..33fbda09e0 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointAzimuthExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TpointAzimuthExpAggregationLogicalFunction::TpointAzimuthExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TpointAzimuthExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TpointAzimuthExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TpointAzimuthExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TpointAzimuthExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TpointAzimuthExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTpointAzimuthExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TpointAzimuthExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointCumulativeLengthExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointCumulativeLengthExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..6f7e4eb5cd --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointCumulativeLengthExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TpointCumulativeLengthExpAggregationLogicalFunction::TpointCumulativeLengthExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TpointCumulativeLengthExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TpointCumulativeLengthExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TpointCumulativeLengthExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TpointCumulativeLengthExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TpointCumulativeLengthExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTpointCumulativeLengthExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TpointCumulativeLengthExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointGetXExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointGetXExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..43f2f1eeba --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointGetXExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TpointGetXExpAggregationLogicalFunction::TpointGetXExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TpointGetXExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TpointGetXExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TpointGetXExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TpointGetXExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TpointGetXExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTpointGetXExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TpointGetXExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointGetYExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointGetYExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..094488b2ce --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointGetYExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TpointGetYExpAggregationLogicalFunction::TpointGetYExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TpointGetYExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TpointGetYExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TpointGetYExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TpointGetYExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TpointGetYExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTpointGetYExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TpointGetYExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointSpeedExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointSpeedExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..b8f6846e33 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointSpeedExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TpointSpeedExpAggregationLogicalFunction::TpointSpeedExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TpointSpeedExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TpointSpeedExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TpointSpeedExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TpointSpeedExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TpointSpeedExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTpointSpeedExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TpointSpeedExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointTwcentroidExpAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointTwcentroidExpAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..c63eed1751 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TpointTwcentroidExpAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TpointTwcentroidExpAggregationLogicalFunction::TpointTwcentroidExpAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TpointTwcentroidExpAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TpointTwcentroidExpAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TpointTwcentroidExpAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TpointTwcentroidExpAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TpointTwcentroidExpAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTpointTwcentroidExpAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TpointTwcentroidExpAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TrajectoryWkbAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TrajectoryWkbAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..bb909ea605 --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TrajectoryWkbAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TrajectoryWkbAggregationLogicalFunction::TrajectoryWkbAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TrajectoryWkbAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TrajectoryWkbAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TrajectoryWkbAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TrajectoryWkbAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TrajectoryWkbAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTrajectoryWkbAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TrajectoryWkbAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TspatialExtentAggregationLogicalFunction.cpp b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TspatialExtentAggregationLogicalFunction.cpp new file mode 100644 index 0000000000..c9f401f31b --- /dev/null +++ b/nes-logical-operators/src/Operators/Windows/Aggregations/Meos/TspatialExtentAggregationLogicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{ + +TspatialExtentAggregationLogicalFunction::TspatialExtentAggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{ +} + +std::shared_ptr +TspatialExtentAggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{ + return std::make_shared(lonField, latField, timestampField, lonField); +} + +std::string_view TspatialExtentAggregationLogicalFunction::getName() const noexcept +{ + return NAME; +} + +void TspatialExtentAggregationLogicalFunction::inferStamp(const Schema& schema) +{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + { + throw CannotInferSchema("TspatialExtentAggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + } + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + { + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + } + else + { + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + } + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +} + +NES::SerializableAggregationFunction TspatialExtentAggregationLogicalFunction::serialize() const +{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::RegisterTspatialExtentAggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{ + if (arguments.fields.size() == 4) + { + auto ptr = std::make_shared( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + } + throw CannotDeserialize( + "TspatialExtentAggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {}", + arguments.fields.size()); +} + +} // namespace NES diff --git a/nes-logical-operators/src/Serialization/FunctionSerializationUtil.cpp b/nes-logical-operators/src/Serialization/FunctionSerializationUtil.cpp index 5d472dd4f3..63d411acd3 100644 --- a/nes-logical-operators/src/Serialization/FunctionSerializationUtil.cpp +++ b/nes-logical-operators/src/Serialization/FunctionSerializationUtil.cpp @@ -63,8 +63,13 @@ deserializeWindowAggregationFunction(const SerializableAggregationFunction& seri { const auto& type = serializedFunction.type(); - // Special handling for TemporalSequence: extra fields stored inside on_field.config - if (type == std::string("TemporalSequence")) + // Special handling for TemporalSequence-shaped aggregations: extra fields (lat, ts) are + // packed inside on_field.config. These ops override the serialized type to their own NAME + // (e.g. "TemporalNumInstants"), so detecting the packed-config key — not the literal + // "TemporalSequence" type — is what makes the round-trip work for every such aggregation. + if (type == std::string("TemporalSequence") + || serializedFunction.on_field().config().contains( + std::string(TemporalAggregationSerde::TEMPORAL_SEQUENCE_EXTRA_FIELDS_KEY))) { AggregationLogicalFunctionRegistryArguments args; const auto fields = TemporalAggregationSerde::parseTemporalSequence(serializedFunction); @@ -72,6 +77,10 @@ deserializeWindowAggregationFunction(const SerializableAggregationFunction& seri { args.fields.push_back(f); } + for (const auto& lit : serializedFunction.literals()) + { + args.literals.push_back(lit); + } if (auto function = AggregationLogicalFunctionRegistry::instance().create(type, args)) { return function.value(); diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/BigintExtentAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/BigintExtentAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..bc597273e0 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/BigintExtentAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class BigintExtentAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + BigintExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~BigintExtentAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/BigintUnionAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/BigintUnionAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..517e8ffc72 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/BigintUnionAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class BigintUnionAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + BigintUnionAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~BigintUnionAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/CrossDistanceAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/CrossDistanceAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..5698049b8d --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/CrossDistanceAggregationPhysicalFunction.hpp @@ -0,0 +1,92 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +/** + * @brief Aggregation that emits the BerlinMOD-Q9 cross-distance between two specific + * vehicles per window. + * + * Takes four input fields (lon, lat, timestamp, vehicle_id) plus a per-aggregation + * `(vidA, vidB)` vehicle-pair passed via two SQL integer constant args + * (`CROSS_DISTANCE(lon, lat, ts, vehicle_id, 100, 200)`). The lift step stores per-event + * tuples; the lower step picks the latest known position of each target vehicle within + * the window and emits the spheroidal `geog_distance(POINT, POINT)` between them as a + * FLOAT64. Returns `NaN` when either target vehicle has no observation in the window. + * + * @note `DEFAULT_VID_A` (100) and `DEFAULT_VID_B` (200) preserve the previous + * BerlinMOD-scaffold default; used by the Registrar deserialize path until full Serde + * round-trip for the constant pair is added (currently the proto carries only the 4 + * field + asField args via `SerializableAggregationFunction.extra_fields`). Mirrors the + * Serde caveat from PairMeeting #19. + * + * Closes the MobilityNebula BerlinMOD-Q9 × 3-form partial→full gap; this PR makes the + * target vehicle pair configurable per-query. + */ +class CrossDistanceAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + /// BerlinMOD-scaffold defaults (preserved on the Serde-deserialize path; the parser + /// path always supplies explicit values). + static constexpr uint64_t DEFAULT_VID_A = 100; + static constexpr uint64_t DEFAULT_VID_B = 200; + + CrossDistanceAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + PhysicalFunction vehicleIdFunctionParam, + uint64_t vidA, + uint64_t vidB, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~CrossDistanceAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; + PhysicalFunction vehicleIdFunction; + uint64_t vidA; + uint64_t vidB; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/FloatExtentAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/FloatExtentAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..392433eb93 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/FloatExtentAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class FloatExtentAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + FloatExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~FloatExtentAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/FloatUnionAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/FloatUnionAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..2172dfc7f2 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/FloatUnionAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class FloatUnionAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + FloatUnionAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~FloatUnionAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/IntExtentAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/IntExtentAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..065fa044c6 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/IntExtentAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class IntExtentAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + IntExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~IntExtentAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/IntUnionAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/IntUnionAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..98ba60f6b8 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/IntUnionAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class IntUnionAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + IntUnionAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~IntUnionAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/PairMeetingAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/PairMeetingAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..d254bb4646 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/PairMeetingAggregationPhysicalFunction.hpp @@ -0,0 +1,87 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +/** + * @brief Cartesian aggregation that emits the BerlinMOD-Q5 pair-meeting answer per window. + * + * Takes four input fields: lon, lat, timestamp, vehicle_id, plus a per-aggregation + * `dMeetMetres` distance threshold passed via the SQL constant arg + * (`PAIR_MEETING(lon, lat, ts, vehicle_id, 200.0)`). The lift step stores per-event + * tuples in a PagedVector. The lower step picks each vehicle's last-known position in the + * window, enumerates vehicle pairs (a < b), and emits pairs whose spheroidal distance is + * at most `dMeetMetres`. Result is a VARSIZED string `"vidA,vidB,ts,dist;..."` — same + * shape pattern as TemporalSequence's BINARY(N) result. + * + * @note `DEFAULT_DMEET_METRES` (200 m) preserves the previous BerlinMOD-scaffold + * default; used by the Registrar deserialize path until full Serde round-trip for the + * dMeet constant is added (currently the proto carries only the 4 field + asField args + * via `SerializableAggregationFunction.extra_fields`). + * + * Closes the MobilityNebula BerlinMOD-Q5 × 3-form partial→full gap; this PR makes the + * meeting-distance configurable per-query. + */ +class PairMeetingAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + /// BerlinMOD-scaffold default (preserved when the SQL omits the constant arg via the + /// Serde-deserialize path; the parser path always supplies an explicit value). + static constexpr double DEFAULT_DMEET_METRES = 200.0; + + PairMeetingAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + PhysicalFunction vehicleIdFunctionParam, + double dMeetMetres, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~PairMeetingAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; + PhysicalFunction vehicleIdFunction; + double dMeetMetres; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TLengthExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TLengthExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..fb2e9010d2 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TLengthExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TLengthExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TLengthExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TLengthExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalAtMaxExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalAtMaxExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..4a0c52f5bf --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalAtMaxExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalAtMaxExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalAtMaxExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalAtMaxExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalAtMinExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalAtMinExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..89d86317d4 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalAtMinExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalAtMinExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalAtMinExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalAtMinExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalCopyExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalCopyExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..ae3108015f --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalCopyExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalCopyExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalCopyExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalCopyExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalDerivativeExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalDerivativeExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..44692db9bd --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalDerivativeExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalDerivativeExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalDerivativeExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalDerivativeExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalEndTimestampAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalEndTimestampAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..087688698f --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalEndTimestampAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalEndTimestampAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalEndTimestampAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalEndTimestampAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalLengthAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalLengthAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..cf73b9e743 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalLengthAggregationPhysicalFunction.hpp @@ -0,0 +1,73 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +/** + * @brief Aggregation function that returns the spheroidal length in metres of + * the per-(window, group) trajectory built from the (lon, lat, timestamp) + * tuples lifted into the aggregation state. + * + * Same lift / combine / reset shape as TemporalSequenceAggregationPhysicalFunction; + * the lower step parses the assembled trajectory into a MEOS Temporal object and + * calls MEOS' tpoint_length(Temporal*) to return a single FLOAT64 result. + * + * Used by BerlinMOD-Q6 ("cumulative distance per vehicle") streaming-form + * scaffold: closes the partial→full gap that the prior scaffold documented as + * "PR-B" in docs/berlinmod-streaming-forms.md. + */ +class TemporalLengthAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalLengthAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalLengthAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalLowerIncAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalLowerIncAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..8813c3ef2f --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalLowerIncAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalLowerIncAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalLowerIncAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalLowerIncAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalMinusMaxExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalMinusMaxExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..11df21f0c4 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalMinusMaxExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalMinusMaxExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalMinusMaxExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalMinusMaxExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalMinusMinExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalMinusMinExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..bf727cba5f --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalMinusMinExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalMinusMinExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalMinusMinExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalMinusMinExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumInstantsAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumInstantsAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..0a5846a05b --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumInstantsAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalNumInstantsAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalNumInstantsAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalNumInstantsAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumSequencesAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumSequencesAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..7c16b2768a --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumSequencesAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalNumSequencesAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalNumSequencesAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalNumSequencesAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumTimestampsAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumTimestampsAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..e1c16f7288 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalNumTimestampsAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalNumTimestampsAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalNumTimestampsAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalNumTimestampsAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalStartTimestampAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalStartTimestampAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..7e36deea33 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalStartTimestampAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalStartTimestampAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalStartTimestampAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalStartTimestampAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatAvgValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatAvgValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..357bfcdff3 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatAvgValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTFloatAvgValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTFloatAvgValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTFloatAvgValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatEndValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatEndValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..3a102ebc4d --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatEndValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTFloatEndValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTFloatEndValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTFloatEndValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatMaxValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatMaxValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..c6b0222d44 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatMaxValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTFloatMaxValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTFloatMaxValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTFloatMaxValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatMinValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatMinValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..e99d6626cd --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatMinValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTFloatMinValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTFloatMinValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTFloatMinValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatStartValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatStartValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..d51c01e89a --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTFloatStartValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTFloatStartValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTFloatStartValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTFloatStartValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntAvgValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntAvgValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..2fb133918d --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntAvgValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTIntAvgValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTIntAvgValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTIntAvgValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntEndValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntEndValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..5ceec8e789 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntEndValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTIntEndValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTIntEndValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTIntEndValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntMaxValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntMaxValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..cc3780b870 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntMaxValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTIntMaxValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTIntMaxValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTIntMaxValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntMinValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntMinValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..54733b5848 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntMinValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTIntMinValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTIntMinValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTIntMinValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntStartValueAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntStartValueAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..727921eab0 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTIntStartValueAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTIntStartValueAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTIntStartValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTIntStartValueAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTNumberIntegralAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTNumberIntegralAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..9b049e7c29 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTNumberIntegralAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTNumberIntegralAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTNumberIntegralAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTNumberIntegralAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTNumberTwAvgAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTNumberTwAvgAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..8195a0e071 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTNumberTwAvgAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTNumberTwAvgAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTNumberTwAvgAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTNumberTwAvgAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTPointIsSimpleAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTPointIsSimpleAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..dea1b3395c --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalTPointIsSimpleAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalTPointIsSimpleAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalTPointIsSimpleAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalTPointIsSimpleAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TemporalUpperIncAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalUpperIncAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..18bfaa9963 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TemporalUpperIncAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TemporalUpperIncAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TemporalUpperIncAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TemporalUpperIncAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TgeoCentroidExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TgeoCentroidExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..aa0cf3430f --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TgeoCentroidExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TgeoCentroidExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TgeoCentroidExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TgeoCentroidExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TgeoConvexHullExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TgeoConvexHullExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..91c8aff7c3 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TgeoConvexHullExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TgeoConvexHullExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TgeoConvexHullExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TgeoConvexHullExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TgeoEndValueExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TgeoEndValueExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..241b9da4fd --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TgeoEndValueExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TgeoEndValueExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TgeoEndValueExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TgeoEndValueExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TgeoStartValueExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TgeoStartValueExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..320a4a849f --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TgeoStartValueExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TgeoStartValueExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TgeoStartValueExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TgeoStartValueExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TgeompointToTgeometryExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TgeompointToTgeometryExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..e4567a140c --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TgeompointToTgeometryExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TgeompointToTgeometryExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TgeompointToTgeometryExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TgeompointToTgeometryExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TimestamptzExtentAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TimestamptzExtentAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..aad56534da --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TimestamptzExtentAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TimestamptzExtentAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TimestamptzExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TimestamptzExtentAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TimestamptzUnionAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TimestamptzUnionAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..5c13307c1b --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TimestamptzUnionAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TimestamptzUnionAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TimestamptzUnionAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TimestamptzUnionAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TnpointCumulativeLengthExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TnpointCumulativeLengthExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..a0bf3cf431 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TnpointCumulativeLengthExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TnpointCumulativeLengthExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TnpointCumulativeLengthExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TnpointCumulativeLengthExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TnpointSpeedExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TnpointSpeedExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..e80e15da81 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TnpointSpeedExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TnpointSpeedExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TnpointSpeedExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TnpointSpeedExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TnpointToTgeompointExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TnpointToTgeompointExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..d3fe9e48c8 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TnpointToTgeompointExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TnpointToTgeompointExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TnpointToTgeompointExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TnpointToTgeompointExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TnumberAbsExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberAbsExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..1d7d215d03 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberAbsExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TnumberAbsExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TnumberAbsExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TnumberAbsExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TnumberAngularDifferenceExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberAngularDifferenceExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..86a1e176db --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberAngularDifferenceExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TnumberAngularDifferenceExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TnumberAngularDifferenceExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TnumberAngularDifferenceExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TnumberDeltaValueExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberDeltaValueExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..b64d805192 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberDeltaValueExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TnumberDeltaValueExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TnumberDeltaValueExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TnumberDeltaValueExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TnumberExtentAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberExtentAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..82a961e580 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberExtentAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TnumberExtentAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TnumberExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TnumberExtentAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TnumberTrendExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberTrendExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..f24806a2be --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TnumberTrendExpAggregationPhysicalFunction.hpp @@ -0,0 +1,58 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TnumberTrendExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TnumberTrendExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TnumberTrendExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TpointAngularDifferenceExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TpointAngularDifferenceExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..7d269d7da5 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TpointAngularDifferenceExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TpointAngularDifferenceExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TpointAngularDifferenceExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TpointAngularDifferenceExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TpointAzimuthExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TpointAzimuthExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..1b69ba3ccd --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TpointAzimuthExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TpointAzimuthExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TpointAzimuthExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TpointAzimuthExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TpointCumulativeLengthExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TpointCumulativeLengthExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..f170df4edd --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TpointCumulativeLengthExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TpointCumulativeLengthExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TpointCumulativeLengthExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TpointCumulativeLengthExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TpointGetXExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TpointGetXExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..d053e69968 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TpointGetXExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TpointGetXExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TpointGetXExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TpointGetXExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TpointGetYExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TpointGetYExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..e74c2ab615 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TpointGetYExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TpointGetYExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TpointGetYExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TpointGetYExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TpointSpeedExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TpointSpeedExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..cb85184aec --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TpointSpeedExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TpointSpeedExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TpointSpeedExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TpointSpeedExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TpointTwcentroidExpAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TpointTwcentroidExpAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..ffa67a3742 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TpointTwcentroidExpAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TpointTwcentroidExpAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TpointTwcentroidExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TpointTwcentroidExpAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TrajectoryWkbAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TrajectoryWkbAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..52ce1b2d82 --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TrajectoryWkbAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TrajectoryWkbAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TrajectoryWkbAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TrajectoryWkbAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Aggregation/Function/Meos/TspatialExtentAggregationPhysicalFunction.hpp b/nes-physical-operators/include/Aggregation/Function/Meos/TspatialExtentAggregationPhysicalFunction.hpp new file mode 100644 index 0000000000..067589cf5d --- /dev/null +++ b/nes-physical-operators/include/Aggregation/Function/Meos/TspatialExtentAggregationPhysicalFunction.hpp @@ -0,0 +1,60 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{ + +class TspatialExtentAggregationPhysicalFunction : public AggregationPhysicalFunction +{ +public: + TspatialExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~TspatialExtentAggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}; + +} diff --git a/nes-physical-operators/include/Functions/Meos/AboveStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AboveStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..fcc75d2282 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AboveStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `above_stbox_stbox`. + * + * Per-event above_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AboveStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + AboveStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AboveStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AboveStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..798210cb04 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AboveStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `above_stbox_tspatial`. + * + * Per-event above_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AboveStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + AboveStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AboveTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AboveTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..e2027c6d0d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AboveTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `above_tspatial_stbox`. + * + * Per-event above_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AboveTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + AboveTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AboveTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AboveTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..28f8dc9fec --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AboveTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `above_tspatial_tspatial`. + * + * Per-event above_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AboveTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + AboveTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AdjacentStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AdjacentStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..d415d6084d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AdjacentStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adjacent_stbox_stbox`. + * + * Per-event adjacent_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AdjacentStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + AdjacentStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AdjacentStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AdjacentStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..83bcbdc1f8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AdjacentStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adjacent_stbox_tspatial`. + * + * Per-event adjacent_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AdjacentStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + AdjacentStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AdjacentTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AdjacentTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..172cc94328 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AdjacentTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adjacent_tbox_tnumber`. + * + * Per-event adjacent_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AdjacentTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + AdjacentTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AdjacentTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AdjacentTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..cfb257993d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AdjacentTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adjacent_temporal_temporal`. + * + * Per-event adjacent_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AdjacentTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + AdjacentTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AdjacentTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AdjacentTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..14e812683f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AdjacentTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adjacent_tnumber_tbox`. + * + * Per-event adjacent_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AdjacentTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + AdjacentTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AdjacentTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AdjacentTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..9bb984ced0 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AdjacentTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adjacent_tnumber_tnumber`. + * + * Per-event adjacent_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AdjacentTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + AdjacentTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AdjacentTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AdjacentTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..845d0c1c84 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AdjacentTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adjacent_tspatial_stbox`. + * + * Per-event adjacent_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AdjacentTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + AdjacentTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AdjacentTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AdjacentTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..1d6cd04e3b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AdjacentTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adjacent_tspatial_tspatial`. + * + * Per-event adjacent_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AdjacentTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + AdjacentTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AfterStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AfterStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..0ea1befb38 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AfterStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `after_stbox_stbox`. + * + * Per-event after_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AfterStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + AfterStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AfterStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AfterStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..7513980508 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AfterStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `after_stbox_tspatial`. + * + * Per-event after_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AfterStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + AfterStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AfterTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AfterTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..993ebb3a25 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AfterTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `after_tbox_tnumber`. + * + * Per-event after_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AfterTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + AfterTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AfterTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AfterTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..2dee745f68 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AfterTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `after_temporal_temporal`. + * + * Per-event after_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AfterTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + AfterTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AfterTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AfterTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..59ac856b84 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AfterTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `after_tnumber_tbox`. + * + * Per-event after_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AfterTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + AfterTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AfterTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AfterTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..36e88f65b6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AfterTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `after_tnumber_tnumber`. + * + * Per-event after_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AfterTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + AfterTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AfterTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AfterTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..ec9f28b6bd --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AfterTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `after_tspatial_stbox`. + * + * Per-event after_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AfterTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + AfterTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AfterTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AfterTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..4277d156e1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AfterTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `after_tspatial_tspatial`. + * + * Per-event after_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AfterTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + AfterTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..e1c6f48866 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_float_tfloat`. + * + * Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..74cddcc57e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_int_tint`. + * + * Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqTboolBoolPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqTboolBoolPhysicalFunction.hpp new file mode 100644 index 0000000000..4161c86ce9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqTboolBoolPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_tbool_bool`. + * + * Per-event always_eq_tbool_bool: single-instant tbool against a scalar -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqTboolBoolPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqTboolBoolPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqTcbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqTcbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..36aecc972f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqTcbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_tcbuffer_cbuffer`. + * + * Per-event always_eq_tcbuffer_cbuffer: single-instant tcbuffer vs a static cbuffer -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqTcbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqTcbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqTcbufferTcbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqTcbufferTcbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..51e50ac445 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqTcbufferTcbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_tcbuffer_tcbuffer`. + * + * Per-event always_eq_tcbuffer_tcbuffer between two single-instant tcbuffers -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqTcbufferTcbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqTcbufferTcbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..40f5ae2811 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_temporal_temporal`. + * + * Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..9b1211919b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_tfloat_float`. + * + * Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqTgeoGeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqTgeoGeoPhysicalFunction.hpp new file mode 100644 index 0000000000..1d287892bf --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqTgeoGeoPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_tgeo_geo`. + * + * Per-event always_eq_tgeo_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqTgeoGeoPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqTgeoGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqTgeoTgeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqTgeoTgeoPhysicalFunction.hpp new file mode 100644 index 0000000000..62806536ad --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqTgeoTgeoPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_tgeo_tgeo`. + * + * Per-event always_eq_tgeo_tgeo between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqTgeoTgeoPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqTgeoTgeoPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysEqTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysEqTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..e68119f5f1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysEqTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_eq_tint_int`. + * + * Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysEqTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysEqTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGeFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGeFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..d9c112c82e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGeFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ge_float_tfloat`. + * + * Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGeFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGeIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGeIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..1649ec9aa7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGeIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ge_int_tint`. + * + * Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGeIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGeTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGeTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..e34ef33229 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGeTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ge_temporal_temporal`. + * + * Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGeTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGeTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGeTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..acf8743ab1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGeTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ge_tfloat_float`. + * + * Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGeTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGeTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGeTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..30bc9f3711 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGeTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ge_tint_int`. + * + * Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGeTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGtFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGtFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..fda7374c73 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGtFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_gt_float_tfloat`. + * + * Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGtFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGtFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGtIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGtIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..799a68b512 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGtIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_gt_int_tint`. + * + * Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGtIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGtIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGtTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGtTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..46e9ae1cfb --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGtTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_gt_temporal_temporal`. + * + * Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGtTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGtTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGtTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGtTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..da96cd7554 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGtTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_gt_tfloat_float`. + * + * Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGtTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGtTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysGtTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysGtTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..57e4542f5f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysGtTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_gt_tint_int`. + * + * Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysGtTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysGtTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLeFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLeFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..d7e66d3a84 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLeFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_le_float_tfloat`. + * + * Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLeFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLeIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLeIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..0e7b72466d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLeIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_le_int_tint`. + * + * Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLeIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLeTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLeTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..2c03f8511b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLeTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_le_temporal_temporal`. + * + * Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLeTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLeTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLeTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..65ced88879 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLeTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_le_tfloat_float`. + * + * Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLeTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLeTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLeTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..d42eb8ee1a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLeTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_le_tint_int`. + * + * Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLeTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLtFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLtFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..b9cf1d5c68 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLtFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_lt_float_tfloat`. + * + * Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLtFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLtFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLtIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLtIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..68c26f2c7a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLtIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_lt_int_tint`. + * + * Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLtIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLtIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLtTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLtTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..04786d1dcf --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLtTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_lt_temporal_temporal`. + * + * Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLtTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLtTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLtTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLtTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..9c13eca77f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLtTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_lt_tfloat_float`. + * + * Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLtTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLtTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysLtTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysLtTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..4dd9a9155f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysLtTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_lt_tint_int`. + * + * Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysLtTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysLtTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..b7ae0072f7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_float_tfloat`. + * + * Per-event always comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..91b6205917 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_int_tint`. + * + * Per-event always comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeTboolBoolPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeTboolBoolPhysicalFunction.hpp new file mode 100644 index 0000000000..91609a6a79 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeTboolBoolPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_tbool_bool`. + * + * Per-event always_ne_tbool_bool: single-instant tbool against a scalar -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeTboolBoolPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeTboolBoolPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeTcbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeTcbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..3adb447654 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeTcbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_tcbuffer_cbuffer`. + * + * Per-event always_ne_tcbuffer_cbuffer: single-instant tcbuffer vs a static cbuffer -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeTcbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeTcbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeTcbufferTcbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeTcbufferTcbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..368ada6368 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeTcbufferTcbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_tcbuffer_tcbuffer`. + * + * Per-event always_ne_tcbuffer_tcbuffer between two single-instant tcbuffers -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeTcbufferTcbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeTcbufferTcbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..9637336fe4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_temporal_temporal`. + * + * Per-event always comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..d3970ad0cd --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_tfloat_float`. + * + * Per-event always comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeTgeoGeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeTgeoGeoPhysicalFunction.hpp new file mode 100644 index 0000000000..1a32e1d02b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeTgeoGeoPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_tgeo_geo`. + * + * Per-event always_ne_tgeo_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeTgeoGeoPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeTgeoGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeTgeoTgeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeTgeoTgeoPhysicalFunction.hpp new file mode 100644 index 0000000000..8056f450ed --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeTgeoTgeoPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_tgeo_tgeo`. + * + * Per-event always_ne_tgeo_tgeo between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeTgeoTgeoPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeTgeoTgeoPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AlwaysNeTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AlwaysNeTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..3a429f8a91 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AlwaysNeTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `always_ne_tint_int`. + * + * Per-event always comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AlwaysNeTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + AlwaysNeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/AtouchesTpointGeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/AtouchesTpointGeoPhysicalFunction.hpp new file mode 100644 index 0000000000..0e3490181a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/AtouchesTpointGeoPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tpoint_geo`. + * + * Per-event atouches_tpoint_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class AtouchesTpointGeoPhysicalFunction : public PhysicalFunctionConcept { +public: + AtouchesTpointGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BackStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BackStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..f96179ae76 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BackStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `back_stbox_stbox`. + * + * Per-event back_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BackStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + BackStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BackStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BackStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..748027a9cd --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BackStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `back_stbox_tspatial`. + * + * Per-event back_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BackStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + BackStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BackTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BackTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..c6229d7723 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BackTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `back_tspatial_stbox`. + * + * Per-event back_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BackTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + BackTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BackTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BackTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..9fd6277fde --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BackTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `back_tspatial_tspatial`. + * + * Per-event back_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BackTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + BackTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BeforeStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BeforeStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..3f9748baa2 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BeforeStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `before_stbox_stbox`. + * + * Per-event before_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BeforeStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + BeforeStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BeforeStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BeforeStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..7c4581848f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BeforeStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `before_stbox_tspatial`. + * + * Per-event before_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BeforeStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + BeforeStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BeforeTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BeforeTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..0671cdd9cb --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BeforeTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `before_tbox_tnumber`. + * + * Per-event before_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BeforeTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + BeforeTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BeforeTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BeforeTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..e7929154b6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BeforeTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `before_temporal_temporal`. + * + * Per-event before_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BeforeTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + BeforeTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BeforeTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BeforeTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..84ef46ed2c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BeforeTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `before_tnumber_tbox`. + * + * Per-event before_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BeforeTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + BeforeTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BeforeTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BeforeTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..db3a60e746 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BeforeTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `before_tnumber_tnumber`. + * + * Per-event before_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BeforeTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + BeforeTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BeforeTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BeforeTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..6db817fff7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BeforeTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `before_tspatial_stbox`. + * + * Per-event before_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BeforeTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + BeforeTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BeforeTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BeforeTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..12dee8880a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BeforeTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `before_tspatial_tspatial`. + * + * Per-event before_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BeforeTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + BeforeTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BelowStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BelowStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..2eab091446 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BelowStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `below_stbox_stbox`. + * + * Per-event below_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BelowStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + BelowStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BelowStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BelowStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..36c8667258 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BelowStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `below_stbox_tspatial`. + * + * Per-event below_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BelowStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + BelowStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BelowTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BelowTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..37ad24fc03 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BelowTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `below_tspatial_stbox`. + * + * Per-event below_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BelowTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + BelowTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/BelowTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/BelowTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..db76640313 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/BelowTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `below_tspatial_tspatial`. + * + * Per-event below_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class BelowTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + BelowTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainedStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainedStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..2c118102c9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainedStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contained_stbox_stbox`. + * + * Per-event contained_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainedStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainedStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainedStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainedStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..d6bbe738f8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainedStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contained_stbox_tspatial`. + * + * Per-event contained_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainedStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainedStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainedTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainedTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..c99bc70090 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainedTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contained_tbox_tnumber`. + * + * Per-event contained_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainedTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainedTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainedTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainedTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..42014329e5 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainedTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contained_temporal_temporal`. + * + * Per-event contained_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainedTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainedTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainedTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainedTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..8cbb4abd3b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainedTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contained_tnumber_tbox`. + * + * Per-event contained_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainedTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainedTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainedTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainedTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..1fa1328960 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainedTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contained_tnumber_tnumber`. + * + * Per-event contained_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainedTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainedTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainedTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainedTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..b7930b9749 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainedTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contained_tspatial_stbox`. + * + * Per-event contained_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainedTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainedTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainedTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainedTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..3caddfcacd --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainedTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contained_tspatial_tspatial`. + * + * Per-event contained_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainedTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainedTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainsStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainsStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..be0cb5afcf --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainsStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contains_stbox_stbox`. + * + * Per-event contains_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainsStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainsStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainsStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainsStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..df3afeb3a9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainsStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contains_stbox_tspatial`. + * + * Per-event contains_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainsStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainsStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainsTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainsTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..ce54044a0a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainsTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contains_tbox_tnumber`. + * + * Per-event contains_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainsTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainsTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainsTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainsTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..a8c19783ae --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainsTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contains_temporal_temporal`. + * + * Per-event contains_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainsTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainsTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainsTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainsTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..56fc5288ed --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainsTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contains_tnumber_tbox`. + * + * Per-event contains_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainsTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainsTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainsTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainsTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..a4124cedcf --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainsTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contains_tnumber_tnumber`. + * + * Per-event contains_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainsTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainsTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainsTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainsTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..4ac369805d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainsTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contains_tspatial_stbox`. + * + * Per-event contains_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainsTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainsTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/ContainsTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/ContainsTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..072c3e98ad --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/ContainsTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `contains_tspatial_tspatial`. + * + * Per-event contains_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class ContainsTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + ContainsTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EtouchesTpointGeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EtouchesTpointGeoPhysicalFunction.hpp new file mode 100644 index 0000000000..0bc6b778e9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EtouchesTpointGeoPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tpoint_geo`. + * + * Per-event etouches_tpoint_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EtouchesTpointGeoPhysicalFunction : public PhysicalFunctionConcept { +public: + EtouchesTpointGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..d9c4363cdd --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_float_tfloat`. + * + * Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..c578724d1e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_int_tint`. + * + * Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqTboolBoolPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqTboolBoolPhysicalFunction.hpp new file mode 100644 index 0000000000..2a59bca848 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqTboolBoolPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_tbool_bool`. + * + * Per-event ever_eq_tbool_bool: single-instant tbool against a scalar -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqTboolBoolPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqTboolBoolPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqTcbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqTcbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..067e456e55 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqTcbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_tcbuffer_cbuffer`. + * + * Per-event ever_eq_tcbuffer_cbuffer: single-instant tcbuffer vs a static cbuffer -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqTcbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqTcbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqTcbufferTcbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqTcbufferTcbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..d1c0e7f59e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqTcbufferTcbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_tcbuffer_tcbuffer`. + * + * Per-event ever_eq_tcbuffer_tcbuffer between two single-instant tcbuffers -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqTcbufferTcbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqTcbufferTcbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..3ba7c32cf0 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_temporal_temporal`. + * + * Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..4b575243ff --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_tfloat_float`. + * + * Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqTgeoGeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqTgeoGeoPhysicalFunction.hpp new file mode 100644 index 0000000000..03c810ca10 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqTgeoGeoPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_tgeo_geo`. + * + * Per-event ever_eq_tgeo_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqTgeoGeoPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqTgeoGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqTgeoTgeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqTgeoTgeoPhysicalFunction.hpp new file mode 100644 index 0000000000..f70a87fff8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqTgeoTgeoPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_tgeo_tgeo`. + * + * Per-event ever_eq_tgeo_tgeo between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqTgeoTgeoPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqTgeoTgeoPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverEqTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverEqTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..9651d94ee9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverEqTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_eq_tint_int`. + * + * Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverEqTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + EverEqTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGeFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGeFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..06ba452247 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGeFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ge_float_tfloat`. + * + * Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGeFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGeIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGeIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..97d5ddf6f9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGeIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ge_int_tint`. + * + * Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGeIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGeTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGeTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..9dc28e309f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGeTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ge_temporal_temporal`. + * + * Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGeTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGeTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGeTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..2feab9cff7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGeTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ge_tfloat_float`. + * + * Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGeTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGeTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGeTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..0e7ab9957d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGeTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ge_tint_int`. + * + * Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGeTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGtFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGtFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..12ccef1d0a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGtFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_gt_float_tfloat`. + * + * Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGtFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGtFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGtIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGtIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..075bbb11af --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGtIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_gt_int_tint`. + * + * Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGtIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGtIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGtTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGtTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..a9444deaf6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGtTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_gt_temporal_temporal`. + * + * Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGtTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGtTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGtTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGtTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..77bb8c4682 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGtTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_gt_tfloat_float`. + * + * Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGtTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGtTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverGtTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverGtTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..9342e82fa8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverGtTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_gt_tint_int`. + * + * Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverGtTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + EverGtTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLeFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLeFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..ed42a74157 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLeFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_le_float_tfloat`. + * + * Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLeFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLeIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLeIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..894400a26f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLeIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_le_int_tint`. + * + * Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLeIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLeTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLeTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..8b38c44794 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLeTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_le_temporal_temporal`. + * + * Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLeTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLeTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLeTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..4a844ae58d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLeTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_le_tfloat_float`. + * + * Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLeTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLeTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLeTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..f819afb068 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLeTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_le_tint_int`. + * + * Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLeTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLtFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLtFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..c977dd0aa9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLtFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_lt_float_tfloat`. + * + * Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLtFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLtFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLtIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLtIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..cdcc840a4a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLtIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_lt_int_tint`. + * + * Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLtIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLtIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLtTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLtTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..793e51f21f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLtTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_lt_temporal_temporal`. + * + * Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLtTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLtTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLtTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLtTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..e1f947119e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLtTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_lt_tfloat_float`. + * + * Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLtTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLtTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverLtTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverLtTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..df024ce4f3 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverLtTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_lt_tint_int`. + * + * Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverLtTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + EverLtTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeFloatTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeFloatTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..fa11ccd9d4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeFloatTfloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_float_tfloat`. + * + * Per-event ever comparison of a scalar constant against a single-instant tfloat (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeFloatTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeIntTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeIntTintPhysicalFunction.hpp new file mode 100644 index 0000000000..748786d311 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeIntTintPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_int_tint`. + * + * Per-event ever comparison of a scalar constant against a single-instant tint (built from value+timestamp); scalar-first MEOS arg order. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeIntTintPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeTboolBoolPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeTboolBoolPhysicalFunction.hpp new file mode 100644 index 0000000000..ff3644dcf9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeTboolBoolPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_tbool_bool`. + * + * Per-event ever_ne_tbool_bool: single-instant tbool against a scalar -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeTboolBoolPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeTboolBoolPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeTcbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeTcbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..8d0ea266f7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeTcbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_tcbuffer_cbuffer`. + * + * Per-event ever_ne_tcbuffer_cbuffer: single-instant tcbuffer vs a static cbuffer -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeTcbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeTcbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeTcbufferTcbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeTcbufferTcbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..fcbc8cc3c7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeTcbufferTcbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_tcbuffer_tcbuffer`. + * + * Per-event ever_ne_tcbuffer_tcbuffer between two single-instant tcbuffers -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeTcbufferTcbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeTcbufferTcbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..a9d407335d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_temporal_temporal`. + * + * Per-event ever comparison between two single-instant temporals (built from valueA/tsA and valueB/tsB). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeTfloatFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeTfloatFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..14d761b5bf --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeTfloatFloatPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_tfloat_float`. + * + * Per-event ever comparison of a single-instant tfloat (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeTfloatFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeTgeoGeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeTgeoGeoPhysicalFunction.hpp new file mode 100644 index 0000000000..0cf7b634f7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeTgeoGeoPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_tgeo_geo`. + * + * Per-event ever_ne_tgeo_geo: single-instant tgeompoint vs a static geometry -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeTgeoGeoPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeTgeoGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeTgeoTgeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeTgeoTgeoPhysicalFunction.hpp new file mode 100644 index 0000000000..e656640faa --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeTgeoTgeoPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_tgeo_tgeo`. + * + * Per-event ever_ne_tgeo_tgeo between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeTgeoTgeoPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeTgeoTgeoPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/EverNeTintIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/EverNeTintIntPhysicalFunction.hpp new file mode 100644 index 0000000000..f0974bf6d1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/EverNeTintIntPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ever_ne_tint_int`. + * + * Per-event ever comparison of a single-instant tint (built from value+timestamp) against a scalar constant. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class EverNeTintIntPhysicalFunction : public PhysicalFunctionConcept { +public: + EverNeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/FrontStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/FrontStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..d07d7a17d4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/FrontStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `front_stbox_stbox`. + * + * Per-event front_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class FrontStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + FrontStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/FrontStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/FrontStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..37057a5b5d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/FrontStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `front_stbox_tspatial`. + * + * Per-event front_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class FrontStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + FrontStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/FrontTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/FrontTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..9b7428d767 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/FrontTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `front_tspatial_stbox`. + * + * Per-event front_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class FrontTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + FrontTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/FrontTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/FrontTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..2b1621828a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/FrontTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `front_tspatial_tspatial`. + * + * Per-event front_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class FrontTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + FrontTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/LeftStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/LeftStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..c1dbf64385 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/LeftStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `left_stbox_stbox`. + * + * Per-event left_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class LeftStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + LeftStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/LeftStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/LeftStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..0b94ee7851 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/LeftStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `left_stbox_tspatial`. + * + * Per-event left_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class LeftStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + LeftStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/LeftTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/LeftTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..86dbc931bc --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/LeftTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `left_tbox_tnumber`. + * + * Per-event left_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class LeftTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + LeftTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/LeftTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/LeftTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..4013dae71b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/LeftTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `left_tnumber_tbox`. + * + * Per-event left_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class LeftTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + LeftTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/LeftTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/LeftTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..0a1c09c526 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/LeftTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `left_tnumber_tnumber`. + * + * Per-event left_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class LeftTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + LeftTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/LeftTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/LeftTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..c5ec58ecb7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/LeftTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `left_tspatial_stbox`. + * + * Per-event left_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class LeftTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + LeftTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/LeftTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/LeftTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..f50ece57ce --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/LeftTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `left_tspatial_tspatial`. + * + * Per-event left_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class LeftTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + LeftTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..d597a5c8be --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_stbox_stbox`. + * + * Per-event nad_stbox_stbox: two per-vehicle extent STBoxes -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + NadStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadTcbufferStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadTcbufferStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..6c28a37fb1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadTcbufferStboxPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tcbuffer_stbox`. + * + * Per-event nad_tcbuffer_stbox: single-instant tcbuffer against a stbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadTcbufferStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + NadTcbufferStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadTfloatTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadTfloatTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..b9cddb896d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadTfloatTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tfloat_tbox`. + * + * Per-event nad_tfloat_tbox: single-instant tfloat against a tbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadTfloatTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + NadTfloatTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadTgeoStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadTgeoStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..92f4a0d357 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadTgeoStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tgeo_stbox`. + * + * Per-event nad_tgeo_stbox: single-instant tgeompoint against a stbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadTgeoStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + NadTgeoStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadTintTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadTintTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..3ffa1c3812 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadTintTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tint_tbox`. + * + * Per-event nad_tint_tbox: single-instant tint against a tbox literal -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadTintTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + NadTintTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadTnpointGeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadTnpointGeoPhysicalFunction.hpp new file mode 100644 index 0000000000..f8fa237e6f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadTnpointGeoPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tnpoint_geo`. + * + * Per-event nad_tnpoint_geo: single-instant tnpoint against a static geometry -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadTnpointGeoPhysicalFunction : public PhysicalFunctionConcept { +public: + NadTnpointGeoPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fracFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadTnpointStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadTnpointStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..e2bc74bdce --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadTnpointStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tnpoint_stbox`. + * + * Per-event nad_tnpoint_stbox: single-instant tnpoint against a stbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadTnpointStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + NadTnpointStboxPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fracFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadTposeGeoPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadTposeGeoPhysicalFunction.hpp new file mode 100644 index 0000000000..85cea1eed6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadTposeGeoPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tpose_geo`. + * + * Per-event nad_tpose_geo: single-instant tpose against a static geometry -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadTposeGeoPhysicalFunction : public PhysicalFunctionConcept { +public: + NadTposeGeoPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/NadTposeStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/NadTposeStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..8731bbdc33 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/NadTposeStboxPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tpose_stbox`. + * + * Per-event nad_tpose_stbox: single-instant tpose against a stbox literal -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class NadTposeStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + NadTposeStboxPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OveraboveStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OveraboveStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..3a22b16833 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OveraboveStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overabove_stbox_stbox`. + * + * Per-event overabove_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OveraboveStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OveraboveStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OveraboveStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OveraboveStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..6629da2ef0 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OveraboveStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overabove_stbox_tspatial`. + * + * Per-event overabove_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OveraboveStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OveraboveStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OveraboveTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OveraboveTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..6df484836e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OveraboveTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overabove_tspatial_stbox`. + * + * Per-event overabove_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OveraboveTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OveraboveTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OveraboveTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OveraboveTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..9484c4aadc --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OveraboveTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overabove_tspatial_tspatial`. + * + * Per-event overabove_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OveraboveTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OveraboveTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverafterStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverafterStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..edfdc16f96 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverafterStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overafter_stbox_stbox`. + * + * Per-event overafter_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverafterStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverafterStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverafterStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverafterStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..ed810c6a7f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverafterStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overafter_stbox_tspatial`. + * + * Per-event overafter_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverafterStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverafterStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverafterTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverafterTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..8d09eb340c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverafterTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overafter_tbox_tnumber`. + * + * Per-event overafter_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverafterTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverafterTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverafterTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverafterTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..8015e489e9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverafterTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overafter_temporal_temporal`. + * + * Per-event overafter_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverafterTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + OverafterTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverafterTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverafterTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..8df6af13ef --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverafterTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overafter_tnumber_tbox`. + * + * Per-event overafter_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverafterTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverafterTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverafterTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverafterTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..48905cd69d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverafterTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overafter_tnumber_tnumber`. + * + * Per-event overafter_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverafterTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverafterTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverafterTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverafterTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..e87e01e65e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverafterTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overafter_tspatial_stbox`. + * + * Per-event overafter_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverafterTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverafterTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverafterTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverafterTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..dd046f3382 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverafterTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overafter_tspatial_tspatial`. + * + * Per-event overafter_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverafterTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverafterTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbackStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbackStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..1ffda20db7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbackStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overback_stbox_stbox`. + * + * Per-event overback_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbackStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbackStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbackStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbackStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..de7c6b4b48 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbackStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overback_stbox_tspatial`. + * + * Per-event overback_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbackStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbackStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbackTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbackTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..a06a640280 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbackTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overback_tspatial_stbox`. + * + * Per-event overback_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbackTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbackTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbackTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbackTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..dc591d9f95 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbackTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overback_tspatial_tspatial`. + * + * Per-event overback_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbackTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbackTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbeforeStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbeforeStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..913619bc0f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbeforeStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbefore_stbox_stbox`. + * + * Per-event overbefore_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbeforeStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbeforeStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbeforeStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbeforeStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..61f2a0d110 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbeforeStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbefore_stbox_tspatial`. + * + * Per-event overbefore_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbeforeStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbeforeStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbeforeTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbeforeTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..1f64d8be91 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbeforeTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbefore_tbox_tnumber`. + * + * Per-event overbefore_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbeforeTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbeforeTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbeforeTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbeforeTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..5176bd34ec --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbeforeTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbefore_temporal_temporal`. + * + * Per-event overbefore_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbeforeTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbeforeTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbeforeTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbeforeTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..fb1a7ff2cd --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbeforeTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbefore_tnumber_tbox`. + * + * Per-event overbefore_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbeforeTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbeforeTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbeforeTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbeforeTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..3b1b0e5a11 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbeforeTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbefore_tnumber_tnumber`. + * + * Per-event overbefore_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbeforeTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbeforeTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbeforeTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbeforeTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..1704387fe9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbeforeTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbefore_tspatial_stbox`. + * + * Per-event overbefore_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbeforeTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbeforeTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbeforeTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbeforeTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..2179e0b43b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbeforeTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbefore_tspatial_tspatial`. + * + * Per-event overbefore_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbeforeTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbeforeTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbelowStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbelowStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..2267de51fe --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbelowStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbelow_stbox_stbox`. + * + * Per-event overbelow_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbelowStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbelowStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbelowStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbelowStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..0b664dbec4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbelowStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbelow_stbox_tspatial`. + * + * Per-event overbelow_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbelowStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbelowStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbelowTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbelowTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..ca47e777d7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbelowTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbelow_tspatial_stbox`. + * + * Per-event overbelow_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbelowTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbelowTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverbelowTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverbelowTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..0c708d4227 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverbelowTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overbelow_tspatial_tspatial`. + * + * Per-event overbelow_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverbelowTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverbelowTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverfrontStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverfrontStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..9009740745 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverfrontStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overfront_stbox_stbox`. + * + * Per-event overfront_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverfrontStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverfrontStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverfrontStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverfrontStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..24731b568c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverfrontStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overfront_stbox_tspatial`. + * + * Per-event overfront_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverfrontStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverfrontStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverfrontTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverfrontTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..912c5f6fa8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverfrontTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overfront_tspatial_stbox`. + * + * Per-event overfront_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverfrontTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverfrontTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverfrontTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverfrontTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..cfdfd5b6c2 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverfrontTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overfront_tspatial_tspatial`. + * + * Per-event overfront_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverfrontTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverfrontTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverlapsStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverlapsStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..bc382c3184 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverlapsStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overlaps_stbox_stbox`. + * + * Per-event overlaps_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverlapsStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverlapsStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverlapsStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverlapsStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..45874910da --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverlapsStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overlaps_stbox_tspatial`. + * + * Per-event overlaps_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverlapsStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverlapsStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverlapsTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverlapsTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..8d2c35ae23 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverlapsTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overlaps_tbox_tnumber`. + * + * Per-event overlaps_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverlapsTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverlapsTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverlapsTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverlapsTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..5143b346aa --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverlapsTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overlaps_temporal_temporal`. + * + * Per-event overlaps_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverlapsTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + OverlapsTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverlapsTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverlapsTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..1a6a80a730 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverlapsTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overlaps_tnumber_tbox`. + * + * Per-event overlaps_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverlapsTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverlapsTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverlapsTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverlapsTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..806f81d487 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverlapsTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overlaps_tnumber_tnumber`. + * + * Per-event overlaps_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverlapsTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverlapsTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverlapsTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverlapsTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..c957d06b40 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverlapsTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overlaps_tspatial_stbox`. + * + * Per-event overlaps_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverlapsTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverlapsTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverlapsTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverlapsTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..84272e7fce --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverlapsTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overlaps_tspatial_tspatial`. + * + * Per-event overlaps_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverlapsTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverlapsTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverleftStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverleftStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..8d2f5367f1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverleftStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overleft_stbox_stbox`. + * + * Per-event overleft_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverleftStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverleftStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverleftStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverleftStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..dbf86e7ce1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverleftStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overleft_stbox_tspatial`. + * + * Per-event overleft_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverleftStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverleftStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverleftTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverleftTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..56c4cb671c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverleftTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overleft_tbox_tnumber`. + * + * Per-event overleft_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverleftTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverleftTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverleftTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverleftTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..a91a8be667 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverleftTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overleft_tnumber_tbox`. + * + * Per-event overleft_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverleftTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverleftTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverleftTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverleftTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..9d3f97d1ca --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverleftTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overleft_tnumber_tnumber`. + * + * Per-event overleft_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverleftTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverleftTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverleftTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverleftTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..cecf057979 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverleftTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overleft_tspatial_stbox`. + * + * Per-event overleft_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverleftTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverleftTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverleftTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverleftTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..118ae3401f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverleftTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overleft_tspatial_tspatial`. + * + * Per-event overleft_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverleftTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverleftTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverrightStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverrightStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..4acff6b6f7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverrightStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overright_stbox_stbox`. + * + * Per-event overright_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverrightStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverrightStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverrightStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverrightStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..9635abb07c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverrightStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overright_stbox_tspatial`. + * + * Per-event overright_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverrightStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverrightStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverrightTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverrightTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..fa686c151f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverrightTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overright_tbox_tnumber`. + * + * Per-event overright_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverrightTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverrightTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverrightTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverrightTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..a45e5f2036 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverrightTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overright_tnumber_tbox`. + * + * Per-event overright_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverrightTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverrightTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverrightTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverrightTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..9584264621 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverrightTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overright_tnumber_tnumber`. + * + * Per-event overright_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverrightTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + OverrightTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverrightTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverrightTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..911c557845 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverrightTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overright_tspatial_stbox`. + * + * Per-event overright_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverrightTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + OverrightTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/OverrightTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/OverrightTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..0207fbcda2 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/OverrightTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `overright_tspatial_tspatial`. + * + * Per-event overright_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class OverrightTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + OverrightTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/RightStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/RightStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..605a738225 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/RightStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `right_stbox_stbox`. + * + * Per-event right_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class RightStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + RightStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/RightStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/RightStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..5099bfdd60 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/RightStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `right_stbox_tspatial`. + * + * Per-event right_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class RightStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + RightStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/RightTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/RightTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..ad01a098f2 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/RightTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `right_tbox_tnumber`. + * + * Per-event right_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class RightTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + RightTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/RightTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/RightTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..51e924924e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/RightTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `right_tnumber_tbox`. + * + * Per-event right_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class RightTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + RightTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/RightTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/RightTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..a9f79d7725 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/RightTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `right_tnumber_tnumber`. + * + * Per-event right_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class RightTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + RightTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/RightTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/RightTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..338e46f144 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/RightTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `right_tspatial_stbox`. + * + * Per-event right_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class RightTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + RightTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/RightTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/RightTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..9b161a9052 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/RightTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `right_tspatial_tspatial`. + * + * Per-event right_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class RightTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + RightTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/SameStboxStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/SameStboxStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..72c2c69719 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/SameStboxStboxPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `same_stbox_stbox`. + * + * Per-event same_stbox_stbox: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class SameStboxStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + SameStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/SameStboxTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/SameStboxTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..8455acf807 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/SameStboxTspatialPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `same_stbox_tspatial`. + * + * Per-event same_stbox_tspatial: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class SameStboxTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + SameStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/SameTboxTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/SameTboxTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..4350a5791d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/SameTboxTnumberPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `same_tbox_tnumber`. + * + * Per-event same_tbox_tnumber: single-instant tfloat against a TBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class SameTboxTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + SameTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/SameTemporalTemporalPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/SameTemporalTemporalPhysicalFunction.hpp new file mode 100644 index 0000000000..a26709cc39 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/SameTemporalTemporalPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `same_temporal_temporal`. + * + * Per-event same_temporal_temporal between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class SameTemporalTemporalPhysicalFunction : public PhysicalFunctionConcept { +public: + SameTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/SameTnumberTboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/SameTnumberTboxPhysicalFunction.hpp new file mode 100644 index 0000000000..dcb648e24e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/SameTnumberTboxPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `same_tnumber_tbox`. + * + * Per-event same_tnumber_tbox: single-instant tfloat against a tbox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class SameTnumberTboxPhysicalFunction : public PhysicalFunctionConcept { +public: + SameTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/SameTnumberTnumberPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/SameTnumberTnumberPhysicalFunction.hpp new file mode 100644 index 0000000000..1847560310 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/SameTnumberTnumberPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `same_tnumber_tnumber`. + * + * Per-event same_tnumber_tnumber: two hex-WKB temporal operands -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class SameTnumberTnumberPhysicalFunction : public PhysicalFunctionConcept { +public: + SameTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/SameTspatialStboxPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/SameTspatialStboxPhysicalFunction.hpp new file mode 100644 index 0000000000..d75e475ebf --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/SameTspatialStboxPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `same_tspatial_stbox`. + * + * Per-event same_tspatial_stbox: single-instant tgeompoint against a STBox literal -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class SameTspatialStboxPhysicalFunction : public PhysicalFunctionConcept { +public: + SameTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/SameTspatialTspatialPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/SameTspatialTspatialPhysicalFunction.hpp new file mode 100644 index 0000000000..fb113e1254 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/SameTspatialTspatialPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `same_tspatial_tspatial`. + * + * Per-event same_tspatial_tspatial between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class SameTspatialTspatialPhysicalFunction : public PhysicalFunctionConcept { +public: + SameTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/StboxCmpPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/StboxCmpPhysicalFunction.hpp new file mode 100644 index 0000000000..334884d7c6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/StboxCmpPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `stbox_cmp`. + * + * Per-event stbox_cmp: two per-vehicle extent STBoxes -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class StboxCmpPhysicalFunction : public PhysicalFunctionConcept { +public: + StboxCmpPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/StboxEqPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/StboxEqPhysicalFunction.hpp new file mode 100644 index 0000000000..0e6a04d1f9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/StboxEqPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `stbox_eq`. + * + * Per-event stbox_eq: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class StboxEqPhysicalFunction : public PhysicalFunctionConcept { +public: + StboxEqPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/StboxGePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/StboxGePhysicalFunction.hpp new file mode 100644 index 0000000000..05653981fc --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/StboxGePhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `stbox_ge`. + * + * Per-event stbox_ge: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class StboxGePhysicalFunction : public PhysicalFunctionConcept { +public: + StboxGePhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/StboxGtPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/StboxGtPhysicalFunction.hpp new file mode 100644 index 0000000000..98a9099ed7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/StboxGtPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `stbox_gt`. + * + * Per-event stbox_gt: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class StboxGtPhysicalFunction : public PhysicalFunctionConcept { +public: + StboxGtPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/StboxLePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/StboxLePhysicalFunction.hpp new file mode 100644 index 0000000000..8bf2cdd210 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/StboxLePhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `stbox_le`. + * + * Per-event stbox_le: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class StboxLePhysicalFunction : public PhysicalFunctionConcept { +public: + StboxLePhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/StboxLtPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/StboxLtPhysicalFunction.hpp new file mode 100644 index 0000000000..00066d4aa1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/StboxLtPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `stbox_lt`. + * + * Per-event stbox_lt: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class StboxLtPhysicalFunction : public PhysicalFunctionConcept { +public: + StboxLtPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/StboxNePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/StboxNePhysicalFunction.hpp new file mode 100644 index 0000000000..bbfd32c243 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/StboxNePhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `stbox_ne`. + * + * Per-event stbox_ne: two per-vehicle extent STBoxes -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class StboxNePhysicalFunction : public PhysicalFunctionConcept { +public: + StboxNePhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TboolEndValuePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TboolEndValuePhysicalFunction.hpp new file mode 100644 index 0000000000..81d32f4f81 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TboolEndValuePhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tbool_end_value`. + * + * Per-event tbool_end_value: bool accessor over a single-instant tbool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TboolEndValuePhysicalFunction : public PhysicalFunctionConcept { +public: + TboolEndValuePhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TboolStartValuePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TboolStartValuePhysicalFunction.hpp new file mode 100644 index 0000000000..18620e33ba --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TboolStartValuePhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tbool_start_value`. + * + * Per-event tbool_start_value: bool accessor over a single-instant tbool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TboolStartValuePhysicalFunction : public PhysicalFunctionConcept { +public: + TboolStartValuePhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TboolToTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TboolToTintPhysicalFunction.hpp new file mode 100644 index 0000000000..cc9f008b23 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TboolToTintPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tbool_to_tint`. + * + * Per-event tbool_to_tint: single-instant tint transform, value extracted -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TboolToTintPhysicalFunction : public PhysicalFunctionConcept { +public: + TboolToTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TcbufferToTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TcbufferToTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..f2e2f46fea --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TcbufferToTfloatPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tcbuffer_to_tfloat`. + * + * Per-event tcbuffer_to_tfloat: single-instant tcbuffer transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TcbufferToTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + TcbufferToTfloatPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAContainsGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAContainsGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..3c8ad78eb7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAContainsGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acontains_tgeo_geo`. + * + * Per-event always-contains between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAContainsGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAContainsGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAContainsTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..c0d73251a6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acontains_tcbuffer_cbuffer`. + * + * Per-event a-contains between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAContainsTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAContainsTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAContainsTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..c36fea169d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acontains_tcbuffer_geo`. + * + * Per-event always-contains between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAContainsTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAContainsTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAContainsTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..73283d8aac --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acontains_tgeo_tgeo`. + * + * Per-event always-contains between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAContainsTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAContainsTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAContainsTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..98259c0b92 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acontains_tgeo_geo`. + * + * Per-event always-contains between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAContainsTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAContainsTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAContainsTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..62cdb67c18 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acontains_tgeo_tgeo`. + * + * Per-event always-contains between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAContainsTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAContainsTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAContainsTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..6c9256d0bb --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acontains_tgeo_geo`. + * + * Per-event always-contains between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAContainsTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAContainsTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAContainsTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..55d7c6fe47 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAContainsTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acontains_tgeo_tgeo`. + * + * Per-event always-contains between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAContainsTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAContainsTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalACoversTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalACoversTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..6723719046 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalACoversTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acovers_tcbuffer_cbuffer`. + * + * Per-event a-covers between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalACoversTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalACoversTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalACoversTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalACoversTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..2f293663a1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalACoversTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `acovers_tcbuffer_geo`. + * + * Per-event always-covers between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalACoversTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalACoversTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..1189910171 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tgeo_geo`. + * + * Per-event always-distance-within between a single-instant tgeompoint and a static geometry under a static threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..49e809ceae --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tcbuffer_cbuffer`. + * + * Per-event always-distance-within between a single-instant tcbuffer and a static Cbuffer under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..9e65175b33 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tcbuffer_geo`. + * + * Per-event always-distance-within between a single-instant tcbuffer and a static geometry under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinTCbufferGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinTCbufferGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..e7cd0ecd50 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,49 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tcbuffer_tcbuffer`. + * + * Per-event always-distance-within between two single-instant tcbuffers under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..334760a2e7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTGeometryPhysicalFunction.hpp @@ -0,0 +1,47 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tgeo_tgeo`. + * + * Per-event always-distance-within between two single-instant tgeompoints under a static threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..98129a1745 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tgeo_geo`. + * + * Per-event always-dwithin between a tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID), within a distance. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..34ba85c083 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,47 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tgeo_tgeo`. + * + * Per-event always-dwithin between two tgeompoints resolved from tnpoints via tnpoint_to_tgeompoint, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..b7411b9bb4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tgeo_geo`. + * + * Per-event always-dwithin between a tgeompoint resolved from a tpose (x,y,theta,ts) via tpose_to_tpoint and a static geometry, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADWithinTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..ca9b9f4fa6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADWithinTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,49 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adwithin_tgeo_tgeo`. + * + * Per-event always-dwithin between two tgeompoints resolved from tposes via tpose_to_tpoint, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADWithinTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADWithinTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..c49407d389 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tgeo_geo`. + * + * Per-event always-disjoint between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..e01e72e37e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tcbuffer_cbuffer`. + * + * Per-event a-disjoint between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..151c070752 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tcbuffer_geo`. + * + * Per-event always-disjoint between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..dca7b0321d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tcbuffer_tcbuffer`. + * + * Per-event always-disjoint between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..b128b0cd6b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tgeo_tgeo`. + * + * Per-event always-disjoint between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..0f13189eb9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tgeo_geo`. + * + * Per-event always-disjoint between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..55d6a5db3b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tgeo_tgeo`. + * + * Per-event always-disjoint between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..6702225dd8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tgeo_geo`. + * + * Per-event always-disjoint between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalADisjointTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..e66c3eb13a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalADisjointTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `adisjoint_tgeo_tgeo`. + * + * Per-event always-disjoint between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalADisjointTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalADisjointTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..e88ed285a3 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `aintersects_tcbuffer_cbuffer`. + * + * Per-event a-intersects between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAIntersectsTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAIntersectsTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..60321c7807 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `aintersects_tcbuffer_geo`. + * + * Per-event always-intersects between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAIntersectsTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAIntersectsTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..180ef216a6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `aintersects_tcbuffer_tcbuffer`. + * + * Per-event always-intersects between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAIntersectsTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAIntersectsTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..d1c06151d3 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `aintersects_tgeo_tgeo`. + * + * Per-event always-intersects between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAIntersectsTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAIntersectsTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..5cf2cdd831 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `aintersects_tgeo_geo`. + * + * Per-event always-intersects between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAIntersectsTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAIntersectsTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..5975fe3de9 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `aintersects_tgeo_tgeo`. + * + * Per-event always-intersects between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAIntersectsTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAIntersectsTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..f785621a64 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `aintersects_tgeo_geo`. + * + * Per-event always-intersects between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAIntersectsTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAIntersectsTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..048b3d5bb6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAIntersectsTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `aintersects_tgeo_tgeo`. + * + * Per-event always-intersects between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAIntersectsTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAIntersectsTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..24c024a0d2 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tgeo_geo`. + * + * Per-event always-touches between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..60321a22f4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tcbuffer_cbuffer`. + * + * Per-event a-touches between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..ed47cbf565 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tcbuffer_geo`. + * + * Per-event always-touches between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..33de04ee53 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tcbuffer_tcbuffer`. + * + * Per-event always-touches between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..107eb5f6b1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tgeo_tgeo`. + * + * Per-event always-touches between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..ad537884c3 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tgeo_geo`. + * + * Per-event always-touches between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..10dc34765e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tgeo_tgeo`. + * + * Per-event always-touches between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..2788d1847f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tgeo_geo`. + * + * Per-event always-touches between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalATouchesTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..3da14558eb --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalATouchesTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `atouches_tgeo_tgeo`. + * + * Per-event always-touches between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalATouchesTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalATouchesTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalAtGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalAtGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..c6f8389a80 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalAtGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tgeo_at_geom`. + * + * Per-event spatial restriction: 1 if the single-instant tgeompoint survives clipping by the static geometry, 0 if clipped. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalAtGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalAtGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalCmpPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalCmpPhysicalFunction.hpp new file mode 100644 index 0000000000..6f6e1f8914 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalCmpPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_cmp`. + * + * Per-event temporal_cmp between two single-instant tgeompoints -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalCmpPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalCmpPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalDyntimewarpDistancePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalDyntimewarpDistancePhysicalFunction.hpp new file mode 100644 index 0000000000..083a6ed7d1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalDyntimewarpDistancePhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_dyntimewarp_distance`. + * + * Per-event temporal_dyntimewarp_distance between two single-instant tgeompoints -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalDyntimewarpDistancePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalDyntimewarpDistancePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEContainsTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..bdeeceef89 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `econtains_tcbuffer_cbuffer`. + * + * Per-event e-contains between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEContainsTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEContainsTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEContainsTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..3b30d995d7 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `econtains_tcbuffer_geo`. + * + * Per-event ever-contains between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEContainsTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEContainsTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEContainsTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..6182be5e51 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `econtains_tgeo_tgeo`. + * + * Per-event ever-contains between two single-instant tgeompoints built from event fields. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEContainsTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEContainsTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEContainsTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..77cb61b374 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `econtains_tgeo_geo`. + * + * Per-event ever-contains between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEContainsTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEContainsTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEContainsTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..480b1a0e0e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `econtains_tgeo_tgeo`. + * + * Per-event ever-contains between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEContainsTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEContainsTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEContainsTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..1431be56ba --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `econtains_tgeo_geo`. + * + * Per-event ever-contains between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEContainsTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEContainsTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEContainsTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..00e3074da4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEContainsTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `econtains_tgeo_tgeo`. + * + * Per-event ever-contains between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEContainsTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEContainsTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..dce5e1f59b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tgeo_geo`. + * + * Per-event ever-covers between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..5a6a0c8658 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tcbuffer_cbuffer`. + * + * Per-event e-covers between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..2ee94f57bc --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tcbuffer_geo`. + * + * Per-event ever-covers between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..ed25636c8b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tcbuffer_tcbuffer`. + * + * Per-event ever-covers between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..fdc57d10cc --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tgeo_tgeo`. + * + * Per-event ever-covers between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..897a788789 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tgeo_geo`. + * + * Per-event ever-covers between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..f19ad72527 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tgeo_tgeo`. + * + * Per-event ever-covers between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..926fbe9dd1 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tgeo_geo`. + * + * Per-event ever-covers between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalECoversTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalECoversTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..4222076a64 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalECoversTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `ecovers_tgeo_tgeo`. + * + * Per-event ever-covers between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalECoversTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalECoversTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..9273649046 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edwithin_tcbuffer_cbuffer`. + * + * Per-event ever-distance-within between a single-instant tcbuffer and a static Cbuffer under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDWithinTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDWithinTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..d2af00602c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edwithin_tcbuffer_geo`. + * + * Per-event ever-distance-within between a single-instant tcbuffer and a static geometry under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDWithinTCbufferGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDWithinTCbufferGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..902e387933 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,49 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edwithin_tcbuffer_tcbuffer`. + * + * Per-event ever-distance-within between two single-instant tcbuffers under a fixed threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDWithinTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDWithinTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..e3e5734f12 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTGeometryPhysicalFunction.hpp @@ -0,0 +1,47 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edwithin_tgeo_tgeo`. + * + * Per-event ever-distance-within between two single-instant tgeompoints under a static threshold. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDWithinTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDWithinTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..402fb9b7f3 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edwithin_tgeo_geo`. + * + * Per-event ever-dwithin between a tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID), within a distance. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDWithinTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDWithinTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..ca98d29971 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,47 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edwithin_tgeo_tgeo`. + * + * Per-event ever-dwithin between two tgeompoints resolved from tnpoints via tnpoint_to_tgeompoint, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDWithinTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDWithinTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..655609b66e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edwithin_tgeo_geo`. + * + * Per-event ever-dwithin between a tgeompoint resolved from a tpose (x,y,theta,ts) via tpose_to_tpoint and a static geometry, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDWithinTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDWithinTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..88ad075aab --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDWithinTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,49 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edwithin_tgeo_tgeo`. + * + * Per-event ever-dwithin between two tgeompoints resolved from tposes via tpose_to_tpoint, within a distance. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDWithinTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDWithinTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDisjointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..3ee871d499 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edisjoint_tgeo_geo`. + * + * Per-event ever-disjoint between a single-instant tgeompoint built from event fields and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDisjointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDisjointGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..7d38a0e470 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edisjoint_tcbuffer_cbuffer`. + * + * Per-event e-disjoint between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDisjointTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDisjointTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..51c75ef7ca --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edisjoint_tcbuffer_geo`. + * + * Per-event ever-disjoint between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDisjointTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDisjointTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..73436d89d6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edisjoint_tgeo_tgeo`. + * + * Per-event ever-disjoint between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDisjointTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDisjointTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..8dc7ebce85 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edisjoint_tgeo_geo`. + * + * Per-event ever-disjoint between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDisjointTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDisjointTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..1c1708f7ab --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edisjoint_tgeo_tgeo`. + * + * Per-event ever-disjoint between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDisjointTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDisjointTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..90c855d1eb --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edisjoint_tgeo_geo`. + * + * Per-event ever-disjoint between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDisjointTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDisjointTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..065d0e6461 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEDisjointTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `edisjoint_tgeo_tgeo`. + * + * Per-event ever-disjoint between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEDisjointTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEDisjointTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..ba00f089f3 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tgeo_geo`. + * + * Per-event ever-intersects between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..ee41643b3e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tcbuffer_cbuffer`. + * + * Per-event e-intersects between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..06b2a4399b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tcbuffer_geo`. + * + * Per-event ever-intersects between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..e6cdb02f7f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tcbuffer_tcbuffer`. + * + * Per-event ever-intersects between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..15709e4761 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tgeo_tgeo`. + * + * Per-event ever-intersects between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..b0c9be231e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tgeo_geo`. + * + * Per-event ever-intersects between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..a7a00b8140 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tgeo_tgeo`. + * + * Per-event ever-intersects between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..c815791cd4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tgeo_geo`. + * + * Per-event ever-intersects between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..e42b0828b8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEIntersectsTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `eintersects_tgeo_tgeo`. + * + * Per-event ever-intersects between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEIntersectsTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEIntersectsTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..65888d2a61 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tgeo_geo`. + * + * Per-event ever-touches between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..2b6ef362b8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tcbuffer_cbuffer`. + * + * Per-event e-touches between a single-instant tcbuffer and a static Cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..88649ac984 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tcbuffer_geo`. + * + * Per-event ever-touches between a single-instant tcbuffer and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..2cb8da5d40 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tcbuffer_tcbuffer`. + * + * Per-event ever-touches between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..40ca50ec4e --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tgeo_tgeo`. + * + * Per-event ever-touches between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..5f7bd8e9c0 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tgeo_geo`. + * + * Per-event ever-touches between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..9bd2369f50 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tgeo_tgeo`. + * + * Per-event ever-touches between two single-instant tgeompoints, each resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..1568db775a --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tgeo_geo`. + * + * Per-event ever-touches between a single-instant tpose (converted to tgeompoint at runtime) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalETouchesTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..69f44bec62 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalETouchesTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `etouches_tgeo_tgeo`. + * + * Per-event ever-touches between two single-instant tgeompoints, each lifted from a tpose (x,y,theta,ts) via tpose_to_tpoint composition. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalETouchesTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalETouchesTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalEqPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalEqPhysicalFunction.hpp new file mode 100644 index 0000000000..5cb6832deb --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalEqPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_eq`. + * + * Per-event temporal_eq between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalEqPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalEqPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalFrechetDistancePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalFrechetDistancePhysicalFunction.hpp new file mode 100644 index 0000000000..c19bf96031 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalFrechetDistancePhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_frechet_distance`. + * + * Per-event temporal_frechet_distance between two single-instant tgeompoints -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalFrechetDistancePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalFrechetDistancePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalGePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalGePhysicalFunction.hpp new file mode 100644 index 0000000000..42ef414870 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalGePhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_ge`. + * + * Per-event temporal_ge between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalGePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalGePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalGtPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalGtPhysicalFunction.hpp new file mode 100644 index 0000000000..0bf72f85b6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalGtPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_gt`. + * + * Per-event temporal_gt between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalGtPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalGtPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalHausdorffDistancePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalHausdorffDistancePhysicalFunction.hpp new file mode 100644 index 0000000000..144cc49678 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalHausdorffDistancePhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_hausdorff_distance`. + * + * Per-event temporal_hausdorff_distance between two single-instant tgeompoints -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalHausdorffDistancePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalHausdorffDistancePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalLePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalLePhysicalFunction.hpp new file mode 100644 index 0000000000..7c1b69d912 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalLePhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_le`. + * + * Per-event temporal_le between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalLePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalLePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalLtPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalLtPhysicalFunction.hpp new file mode 100644 index 0000000000..60cb0d083c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalLtPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_lt`. + * + * Per-event temporal_lt between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalLtPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalLtPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalMinusGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalMinusGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..804a902946 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalMinusGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tgeo_minus_geom`. + * + * Per-event spatial subtraction: 1 if the single-instant tgeompoint survives subtraction of the static geometry, 0 if removed. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalMinusGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalMinusGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADFloatScalarPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADFloatScalarPhysicalFunction.hpp new file mode 100644 index 0000000000..b2dab0f15d --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADFloatScalarPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tfloat_float`. + * + * Per-event nearest-approach distance between a single-instant tfloat and a scalar double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADFloatScalarPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADFloatScalarPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..9df4f8a948 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tgeo_geo`. + * + * Per-event nearest-approach distance between a single-instant tgeompoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADIntScalarPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADIntScalarPhysicalFunction.hpp new file mode 100644 index 0000000000..cbf6fb5494 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADIntScalarPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tint_int`. + * + * Per-event nearest-approach distance between a single-instant tint and a scalar int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADIntScalarPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADIntScalarPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..945122c4c2 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tcbuffer_cbuffer`. + * + * Per-event nearest-approach distance between a single-instant tcbuffer and a static cbuffer literal. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTCbufferCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLiteralFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..ae281dfe48 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tcbuffer_geo`. + * + * Per-event nearest-approach distance between a single-instant tcbuffer (lon,lat,radius,ts) and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferTCbufferPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferTCbufferPhysicalFunction.hpp new file mode 100644 index 0000000000..862fb05c54 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTCbufferTCbufferPhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tcbuffer_tcbuffer`. + * + * Per-event nearest-approach distance between two single-instant tcbuffers. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTCbufferTCbufferPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTFloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTFloatPhysicalFunction.hpp new file mode 100644 index 0000000000..bfb14c6178 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTFloatPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tfloat_tfloat`. + * + * Per-event nearest-approach distance between two single-instant tfloats. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTFloatPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTFloatPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..7d743b4bda --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTGeometryPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tgeo_tgeo`. + * + * Per-event nearest-approach distance between two single-instant tgeompoints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTIntPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTIntPhysicalFunction.hpp new file mode 100644 index 0000000000..9c711bc4c6 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTIntPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tint_tint`. + * + * Per-event nearest-approach distance between two single-instant tints. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTIntPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTIntPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTNpointGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTNpointGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..371b6d4bf2 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTNpointGeometryPhysicalFunction.hpp @@ -0,0 +1,44 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tgeo_geo`. + * + * Per-event nearest-approach distance between a single-instant tgeompoint resolved from a tnpoint (rid,fraction,ts) via tnpoint_to_tgeompoint and a static geometry (network SRID). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTNpointGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTNpointTNpointPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTNpointTNpointPhysicalFunction.hpp new file mode 100644 index 0000000000..e368b378fc --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTNpointTNpointPhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tgeo_tgeo`. + * + * Per-event nearest-approach distance between two single-instant tgeompoints, each resolved from a tnpoint via tnpoint_to_tgeompoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTNpointTNpointPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTPoseGeometryPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTPoseGeometryPhysicalFunction.hpp new file mode 100644 index 0000000000..36b8ced1ed --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTPoseGeometryPhysicalFunction.hpp @@ -0,0 +1,45 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tgeo_geo`. + * + * Per-event nearest-approach distance between a single-instant tgeompoint resolved from a tpose (x,y,theta,ts) via tpose_to_tpoint and a static geometry. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTPoseGeometryPhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNADTPoseTPosePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNADTPoseTPosePhysicalFunction.hpp new file mode 100644 index 0000000000..af58943b9f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNADTPoseTPosePhysicalFunction.hpp @@ -0,0 +1,48 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `nad_tgeo_tgeo`. + * + * Per-event nearest-approach distance between two single-instant tgeompoints, each resolved from a tpose via tpose_to_tpoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNADTPoseTPosePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNADTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TemporalNePhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TemporalNePhysicalFunction.hpp new file mode 100644 index 0000000000..a9d782f52c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TemporalNePhysicalFunction.hpp @@ -0,0 +1,46 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `temporal_ne`. + * + * Per-event temporal_ne between two single-instant tgeompoints -> bool. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TemporalNePhysicalFunction : public PhysicalFunctionConcept { +public: + TemporalNePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TfloatCeilPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TfloatCeilPhysicalFunction.hpp new file mode 100644 index 0000000000..984628086f --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TfloatCeilPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tfloat_ceil`. + * + * Per-event tfloat_ceil: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TfloatCeilPhysicalFunction : public PhysicalFunctionConcept { +public: + TfloatCeilPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TfloatExpPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TfloatExpPhysicalFunction.hpp new file mode 100644 index 0000000000..3f4c0e84be --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TfloatExpPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tfloat_exp`. + * + * Per-event tfloat_exp: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TfloatExpPhysicalFunction : public PhysicalFunctionConcept { +public: + TfloatExpPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TfloatFloorPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TfloatFloorPhysicalFunction.hpp new file mode 100644 index 0000000000..0e557615a4 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TfloatFloorPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tfloat_floor`. + * + * Per-event tfloat_floor: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TfloatFloorPhysicalFunction : public PhysicalFunctionConcept { +public: + TfloatFloorPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TfloatLnPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TfloatLnPhysicalFunction.hpp new file mode 100644 index 0000000000..e2539cd8f5 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TfloatLnPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tfloat_ln`. + * + * Per-event tfloat_ln: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TfloatLnPhysicalFunction : public PhysicalFunctionConcept { +public: + TfloatLnPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TfloatLog10PhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TfloatLog10PhysicalFunction.hpp new file mode 100644 index 0000000000..47439e84e8 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TfloatLog10PhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tfloat_log10`. + * + * Per-event tfloat_log10: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TfloatLog10PhysicalFunction : public PhysicalFunctionConcept { +public: + TfloatLog10PhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TfloatRadiansPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TfloatRadiansPhysicalFunction.hpp new file mode 100644 index 0000000000..35d25c6f0b --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TfloatRadiansPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tfloat_radians`. + * + * Per-event tfloat_radians: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TfloatRadiansPhysicalFunction : public PhysicalFunctionConcept { +public: + TfloatRadiansPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TfloatToTintPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TfloatToTintPhysicalFunction.hpp new file mode 100644 index 0000000000..eeab6a4123 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TfloatToTintPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tfloat_to_tint`. + * + * Per-event tfloat_to_tint: single-instant tfloat transform, value extracted -> int. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TfloatToTintPhysicalFunction : public PhysicalFunctionConcept { +public: + TfloatToTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TintToTfloatPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TintToTfloatPhysicalFunction.hpp new file mode 100644 index 0000000000..4a3ebf9536 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TintToTfloatPhysicalFunction.hpp @@ -0,0 +1,42 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tint_to_tfloat`. + * + * Per-event tint_to_tfloat: single-instant tfloat transform, value extracted -> double. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TintToTfloatPhysicalFunction : public PhysicalFunctionConcept { +public: + TintToTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TnpointLengthPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TnpointLengthPhysicalFunction.hpp new file mode 100644 index 0000000000..08c0f6037c --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TnpointLengthPhysicalFunction.hpp @@ -0,0 +1,43 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tnpoint_length`. + * + * Per-event tnpoint_length: double accessor over a single-instant tnpoint. + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TnpointLengthPhysicalFunction : public PhysicalFunctionConcept { +public: + TnpointLengthPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fracFunction, + PhysicalFunction tsFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/include/Functions/Meos/TpointLengthWkbPhysicalFunction.hpp b/nes-physical-operators/include/Functions/Meos/TpointLengthWkbPhysicalFunction.hpp new file mode 100644 index 0000000000..85e1cd6ff2 --- /dev/null +++ b/nes-physical-operators/include/Functions/Meos/TpointLengthWkbPhysicalFunction.hpp @@ -0,0 +1,41 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES { + +/** + * @brief Physical operator for `tpoint_length`. + * + * Function-library-over-MEOS-value: tpoint_length applied to an upstream hex-WKB trajectory value (the efficient compose-on-materialized-trajectory mechanism). + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class TpointLengthWkbPhysicalFunction : public PhysicalFunctionConcept { +public: + TpointLengthWkbPhysicalFunction(PhysicalFunction trajFunction); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}; + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/BigintExtentAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/BigintExtentAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..4a3118a259 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/BigintExtentAggregationPhysicalFunction.cpp @@ -0,0 +1,163 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_bigintextent_mutex; + + +BigintExtentAggregationPhysicalFunction::BigintExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void BigintExtentAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental Span accumulator slot: each event folds into the running span; + // O(1) state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int64_t val) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_bigintextent_mutex); + Span** slot = reinterpret_cast(st); + *slot = bigint_extent_transfn(*slot, val); + }, + aggregationState, value); +} + +void BigintExtentAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_bigintextent_mutex); + Span** slot1 = reinterpret_cast(s1); + Span** slot2 = reinterpret_cast(s2); + if (!*slot2) { return; } + if (!*slot1) { *slot1 = span_copy(*slot2); return; } + Span* merged = super_union_span_span(*slot1, *slot2, false); + free(*slot1); + *slot1 = merged; + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record BigintExtentAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto boxStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_bigintextent_mutex); + Span** slot = reinterpret_cast(st); + if (!*slot) { return (char*) nullptr; } + char* out = bigintspan_out(*slot); + free(*slot); + *slot = nullptr; + return out; + }, + aggregationState); + + const auto boxLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, boxStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { if (s) { memcpy(dest, s, len); free((void*) s); } }, + variableSized.getContent(), boxStr, boxLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void BigintExtentAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Span** slot = reinterpret_cast(st); *slot = nullptr; }, aggregationState); +} + +size_t BigintExtentAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Span*); +} + +void BigintExtentAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Span** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterBigintExtentAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("BIGINT_EXTENT aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/BigintUnionAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/BigintUnionAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..c76c2615f2 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/BigintUnionAggregationPhysicalFunction.cpp @@ -0,0 +1,166 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_bigintunion_mutex; + + +BigintUnionAggregationPhysicalFunction::BigintUnionAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void BigintUnionAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental Set accumulator slot: each event folds its value into the + // running set; O(1)-amortized state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int64_t val) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_bigintunion_mutex); + Set** slot = reinterpret_cast(st); + *slot = bigint_union_transfn(*slot, val); + }, + aggregationState, value); +} + +void BigintUnionAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_bigintunion_mutex); + Set** slot1 = reinterpret_cast(s1); + Set** slot2 = reinterpret_cast(s2); + if (!*slot2) { return; } + // set_union_transfn appends slot2's values into slot1 (creates from + // slot2 if slot1 is null); slot2 is freed by its own cleanup. + *slot1 = set_union_transfn(*slot1, *slot2); + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record BigintUnionAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto setStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_bigintunion_mutex); + Set** slot = reinterpret_cast(st); + if (!*slot) { return (char*) nullptr; } + // set_union_finalfn consumes (frees) the state and returns the + // deduplicated, sorted Set; the slot must not be freed again. + Set* fin = set_union_finalfn(*slot); + *slot = nullptr; + if (!fin) { return (char*) nullptr; } + char* out = bigintset_out(fin); + free(fin); + return out; + }, + aggregationState); + + const auto setLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, setStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(setLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { if (s) { memcpy(dest, s, len); free((void*) s); } }, + variableSized.getContent(), setStr, setLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void BigintUnionAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Set** slot = reinterpret_cast(st); *slot = nullptr; }, aggregationState); +} + +size_t BigintUnionAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Set*); +} + +void BigintUnionAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Set** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterBigintUnionAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("BIGINT_UNION aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/CMakeLists.txt b/nes-physical-operators/src/Aggregation/Function/Meos/CMakeLists.txt index c34e12f47e..d7a930682d 100644 --- a/nes-physical-operators/src/Aggregation/Function/Meos/CMakeLists.txt +++ b/nes-physical-operators/src/Aggregation/Function/Meos/CMakeLists.txt @@ -11,4 +11,64 @@ # limitations under the License. add_plugin(TemporalSequence AggregationPhysicalFunction nes-physical-operators TemporalSequenceAggregationPhysicalFunction.cpp) +add_plugin(TemporalLength AggregationPhysicalFunction nes-physical-operators TemporalLengthAggregationPhysicalFunction.cpp) +add_plugin(PairMeeting AggregationPhysicalFunction nes-physical-operators PairMeetingAggregationPhysicalFunction.cpp) +add_plugin(CrossDistance AggregationPhysicalFunction nes-physical-operators CrossDistanceAggregationPhysicalFunction.cpp) add_plugin(Var AggregationPhysicalFunction nes-physical-operators VarAggregationFunction.cpp) +add_plugin(TemporalNumInstants AggregationPhysicalFunction nes-physical-operators TemporalNumInstantsAggregationPhysicalFunction.cpp) +add_plugin(TemporalNumSequences AggregationPhysicalFunction nes-physical-operators TemporalNumSequencesAggregationPhysicalFunction.cpp) +add_plugin(TemporalNumTimestamps AggregationPhysicalFunction nes-physical-operators TemporalNumTimestampsAggregationPhysicalFunction.cpp) +add_plugin(TemporalTFloatStartValue AggregationPhysicalFunction nes-physical-operators TemporalTFloatStartValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTFloatEndValue AggregationPhysicalFunction nes-physical-operators TemporalTFloatEndValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTFloatMinValue AggregationPhysicalFunction nes-physical-operators TemporalTFloatMinValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTFloatMaxValue AggregationPhysicalFunction nes-physical-operators TemporalTFloatMaxValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTNumberIntegral AggregationPhysicalFunction nes-physical-operators TemporalTNumberIntegralAggregationPhysicalFunction.cpp) +add_plugin(TemporalTIntStartValue AggregationPhysicalFunction nes-physical-operators TemporalTIntStartValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTIntEndValue AggregationPhysicalFunction nes-physical-operators TemporalTIntEndValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTIntMinValue AggregationPhysicalFunction nes-physical-operators TemporalTIntMinValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTIntMaxValue AggregationPhysicalFunction nes-physical-operators TemporalTIntMaxValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTFloatAvgValue AggregationPhysicalFunction nes-physical-operators TemporalTFloatAvgValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalTNumberTwAvg AggregationPhysicalFunction nes-physical-operators TemporalTNumberTwAvgAggregationPhysicalFunction.cpp) +add_plugin(TemporalTIntAvgValue AggregationPhysicalFunction nes-physical-operators TemporalTIntAvgValueAggregationPhysicalFunction.cpp) +add_plugin(TemporalStartTimestamp AggregationPhysicalFunction nes-physical-operators TemporalStartTimestampAggregationPhysicalFunction.cpp) +add_plugin(TemporalEndTimestamp AggregationPhysicalFunction nes-physical-operators TemporalEndTimestampAggregationPhysicalFunction.cpp) +add_plugin(TemporalLowerInc AggregationPhysicalFunction nes-physical-operators TemporalLowerIncAggregationPhysicalFunction.cpp) +add_plugin(TemporalUpperInc AggregationPhysicalFunction nes-physical-operators TemporalUpperIncAggregationPhysicalFunction.cpp) +add_plugin(TemporalTPointIsSimple AggregationPhysicalFunction nes-physical-operators TemporalTPointIsSimpleAggregationPhysicalFunction.cpp) +add_plugin(TspatialExtent AggregationPhysicalFunction nes-physical-operators TspatialExtentAggregationPhysicalFunction.cpp) +add_plugin(TnumberExtent AggregationPhysicalFunction nes-physical-operators TnumberExtentAggregationPhysicalFunction.cpp) +add_plugin(FloatExtent AggregationPhysicalFunction nes-physical-operators FloatExtentAggregationPhysicalFunction.cpp) +add_plugin(IntExtent AggregationPhysicalFunction nes-physical-operators IntExtentAggregationPhysicalFunction.cpp) +add_plugin(BigintExtent AggregationPhysicalFunction nes-physical-operators BigintExtentAggregationPhysicalFunction.cpp) +add_plugin(TimestamptzExtent AggregationPhysicalFunction nes-physical-operators TimestamptzExtentAggregationPhysicalFunction.cpp) +add_plugin(FloatUnion AggregationPhysicalFunction nes-physical-operators FloatUnionAggregationPhysicalFunction.cpp) +add_plugin(IntUnion AggregationPhysicalFunction nes-physical-operators IntUnionAggregationPhysicalFunction.cpp) +add_plugin(BigintUnion AggregationPhysicalFunction nes-physical-operators BigintUnionAggregationPhysicalFunction.cpp) +add_plugin(TimestamptzUnion AggregationPhysicalFunction nes-physical-operators TimestamptzUnionAggregationPhysicalFunction.cpp) +add_plugin(TrajectoryWkb AggregationPhysicalFunction nes-physical-operators TrajectoryWkbAggregationPhysicalFunction.cpp) +add_plugin(TLengthExp AggregationPhysicalFunction nes-physical-operators TLengthExpAggregationPhysicalFunction.cpp) +add_plugin(TgeoCentroidExp AggregationPhysicalFunction nes-physical-operators TgeoCentroidExpAggregationPhysicalFunction.cpp) +add_plugin(TpointAzimuthExp AggregationPhysicalFunction nes-physical-operators TpointAzimuthExpAggregationPhysicalFunction.cpp) +add_plugin(TpointAngularDifferenceExp AggregationPhysicalFunction nes-physical-operators TpointAngularDifferenceExpAggregationPhysicalFunction.cpp) +add_plugin(TgeompointToTgeometryExp AggregationPhysicalFunction nes-physical-operators TgeompointToTgeometryExpAggregationPhysicalFunction.cpp) +add_plugin(TemporalCopyExp AggregationPhysicalFunction nes-physical-operators TemporalCopyExpAggregationPhysicalFunction.cpp) +add_plugin(TnumberAbsExp AggregationPhysicalFunction nes-physical-operators TnumberAbsExpAggregationPhysicalFunction.cpp) +add_plugin(TnumberDeltaValueExp AggregationPhysicalFunction nes-physical-operators TnumberDeltaValueExpAggregationPhysicalFunction.cpp) +add_plugin(TnumberAngularDifferenceExp AggregationPhysicalFunction nes-physical-operators TnumberAngularDifferenceExpAggregationPhysicalFunction.cpp) +add_plugin(TemporalDerivativeExp AggregationPhysicalFunction nes-physical-operators TemporalDerivativeExpAggregationPhysicalFunction.cpp) +add_plugin(TemporalAtMaxExp AggregationPhysicalFunction nes-physical-operators TemporalAtMaxExpAggregationPhysicalFunction.cpp) +add_plugin(TemporalAtMinExp AggregationPhysicalFunction nes-physical-operators TemporalAtMinExpAggregationPhysicalFunction.cpp) +add_plugin(TemporalMinusMaxExp AggregationPhysicalFunction nes-physical-operators TemporalMinusMaxExpAggregationPhysicalFunction.cpp) +add_plugin(TemporalMinusMinExp AggregationPhysicalFunction nes-physical-operators TemporalMinusMinExpAggregationPhysicalFunction.cpp) +add_plugin(TnpointCumulativeLengthExp AggregationPhysicalFunction nes-physical-operators TnpointCumulativeLengthExpAggregationPhysicalFunction.cpp) +add_plugin(TnpointSpeedExp AggregationPhysicalFunction nes-physical-operators TnpointSpeedExpAggregationPhysicalFunction.cpp) +add_plugin(TnpointToTgeompointExp AggregationPhysicalFunction nes-physical-operators TnpointToTgeompointExpAggregationPhysicalFunction.cpp) +add_plugin(TpointCumulativeLengthExp AggregationPhysicalFunction nes-physical-operators TpointCumulativeLengthExpAggregationPhysicalFunction.cpp) +add_plugin(TpointSpeedExp AggregationPhysicalFunction nes-physical-operators TpointSpeedExpAggregationPhysicalFunction.cpp) +add_plugin(TpointGetXExp AggregationPhysicalFunction nes-physical-operators TpointGetXExpAggregationPhysicalFunction.cpp) +add_plugin(TpointGetYExp AggregationPhysicalFunction nes-physical-operators TpointGetYExpAggregationPhysicalFunction.cpp) +add_plugin(TnumberTrendExp AggregationPhysicalFunction nes-physical-operators TnumberTrendExpAggregationPhysicalFunction.cpp) +add_plugin(TgeoStartValueExp AggregationPhysicalFunction nes-physical-operators TgeoStartValueExpAggregationPhysicalFunction.cpp) +add_plugin(TgeoEndValueExp AggregationPhysicalFunction nes-physical-operators TgeoEndValueExpAggregationPhysicalFunction.cpp) +add_plugin(TgeoConvexHullExp AggregationPhysicalFunction nes-physical-operators TgeoConvexHullExpAggregationPhysicalFunction.cpp) +add_plugin(TpointTwcentroidExp AggregationPhysicalFunction nes-physical-operators TpointTwcentroidExpAggregationPhysicalFunction.cpp) diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/CrossDistanceAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/CrossDistanceAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..5ea4a126a9 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/CrossDistanceAggregationPhysicalFunction.cpp @@ -0,0 +1,286 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; +constexpr static std::string_view VehicleIdFieldName = "vehicle_id"; + +static std::mutex cross_distance_mutex; + +CrossDistanceAggregationPhysicalFunction::CrossDistanceAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + PhysicalFunction vehicleIdFunctionParam, + uint64_t vidA, + uint64_t vidB, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) + , vehicleIdFunction(std::move(vehicleIdFunctionParam)) + , vidA(vidA) + , vidB(vidB) +{ +} + +void CrossDistanceAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + auto vehicleIdValue = vehicleIdFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue}, + {std::string(VehicleIdFieldName), vehicleIdValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void CrossDistanceAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record CrossDistanceAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(std::numeric_limits::quiet_NaN())); + return resultRecord; + } + + // Allocate a 6-double scratch buffer on the heap (we cannot put std::optional<…> structures + // through the nautilus invoke ABI). Layout: [lonA, latA, tsA, lonB, latB, tsB]. + // Sentinel ts = -1 means "not yet observed". + auto scratchPtr = nautilus::invoke( + +[]() -> double* + { + double* scratch = (double*)malloc(sizeof(double) * 6); + // Bit-cast tsA, tsB sentinels by writing -1 as the int64 reinterpret of the double. + // We just set them to NaN markers and treat NaN as "not observed". + scratch[0] = std::numeric_limits::quiet_NaN(); + scratch[1] = std::numeric_limits::quiet_NaN(); + scratch[2] = std::numeric_limits::quiet_NaN(); + scratch[3] = std::numeric_limits::quiet_NaN(); + scratch[4] = std::numeric_limits::quiet_NaN(); + scratch[5] = std::numeric_limits::quiet_NaN(); + return scratch; + }); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + const auto vehicleIdValue = itemRecord.read(std::string(VehicleIdFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + auto vehicleId = vehicleIdValue.cast>(); + + // Overwrite-on-match — final value is the latest event for each target VID in iter order. + // vidA / vidB are passed through to the captureless lambda alongside the state + // pointer (Nautilus invoke ABI forbids closures); same pattern as + // PairMeetingAggregationPhysicalFunction's dMeet threading in PR #19. + nautilus::invoke( + +[](double* scratch, double lonVal, double latVal, int64_t tsVal, uint64_t vid, + uint64_t vidAArg, uint64_t vidBArg) -> void + { + if (vid == vidAArg) { + scratch[0] = lonVal; + scratch[1] = latVal; + scratch[2] = static_cast(tsVal); + } else if (vid == vidBArg) { + scratch[3] = lonVal; + scratch[4] = latVal; + scratch[5] = static_cast(tsVal); + } + }, + scratchPtr, lon, lat, timestamp, vehicleId, + nautilus::val(vidA), nautilus::val(vidB)); + } + + auto distanceMetres = nautilus::invoke( + +[](double* scratch) -> double + { + // If either target vehicle has no observation in the window, return NaN. + if (std::isnan(scratch[2]) || std::isnan(scratch[5])) { + free(scratch); + return std::numeric_limits::quiet_NaN(); + } + + std::lock_guard lock(cross_distance_mutex); + + char wktA[80]; + char wktB[80]; + snprintf(wktA, sizeof(wktA), "SRID=4326;Point(%.7f %.7f)", scratch[0], scratch[1]); + snprintf(wktB, sizeof(wktB), "SRID=4326;Point(%.7f %.7f)", scratch[3], scratch[4]); + free(scratch); + + GSERIALIZED* gA = geom_in(wktA, -1); + GSERIALIZED* gB = geom_in(wktB, -1); + if (gA == nullptr || gB == nullptr) { + if (gA) free(gA); + if (gB) free(gB); + return std::numeric_limits::quiet_NaN(); + } + GSERIALIZED* ggA = geom_to_geog(gA); + GSERIALIZED* ggB = geom_to_geog(gB); + + // For the spheroidal distance, dwithin probes only give boolean output; we want a + // numeric value. The PROJ/MEOS shared object exposes `geog_distance` for this; here + // we instead drive the MEOS NAD over single-instant tgeompoints which goes through + // the same geog_distance path internally. + char tgeoA[120]; + char tgeoB[120]; + snprintf(tgeoA, sizeof(tgeoA), "Point(%.7f %.7f)@2000-01-01 00:00:00", scratch[0], scratch[1]); + snprintf(tgeoB, sizeof(tgeoB), "Point(%.7f %.7f)@2000-01-01 00:00:00", scratch[3], scratch[4]); + Temporal* tA = (Temporal*)MEOS::Meos::parseTemporalPoint(std::string(tgeoA)); + Temporal* tB = (Temporal*)MEOS::Meos::parseTemporalPoint(std::string(tgeoB)); + double distance = std::numeric_limits::quiet_NaN(); + if (tA != nullptr && tB != nullptr) { + distance = nad_tgeo_tgeo(tA, tB); + } + if (tA != nullptr) MEOS::Meos::freeTemporalObject(tA); + if (tB != nullptr) MEOS::Meos::freeTemporalObject(tB); + free(ggA); + free(ggB); + free(gA); + free(gB); + return distance; + }, + scratchPtr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, distanceMetres); + return resultRecord; +} + +void CrossDistanceAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t CrossDistanceAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void CrossDistanceAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast( + pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterCrossDistanceAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("CROSS_DISTANCE aggregation cannot be created through the registry. " + "It requires four field functions (longitude, latitude, timestamp, vehicle_id)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/FloatExtentAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/FloatExtentAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..e24016faf7 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/FloatExtentAggregationPhysicalFunction.cpp @@ -0,0 +1,163 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_floatextent_mutex; + + +FloatExtentAggregationPhysicalFunction::FloatExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void FloatExtentAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental Span accumulator slot: each event folds into the running span; + // O(1) state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double val) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_floatextent_mutex); + Span** slot = reinterpret_cast(st); + *slot = float_extent_transfn(*slot, val); + }, + aggregationState, value); +} + +void FloatExtentAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_floatextent_mutex); + Span** slot1 = reinterpret_cast(s1); + Span** slot2 = reinterpret_cast(s2); + if (!*slot2) { return; } + if (!*slot1) { *slot1 = span_copy(*slot2); return; } + Span* merged = super_union_span_span(*slot1, *slot2, false); + free(*slot1); + *slot1 = merged; + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record FloatExtentAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto boxStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_floatextent_mutex); + Span** slot = reinterpret_cast(st); + if (!*slot) { return (char*) nullptr; } + char* out = floatspan_out(*slot, 15); + free(*slot); + *slot = nullptr; + return out; + }, + aggregationState); + + const auto boxLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, boxStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { if (s) { memcpy(dest, s, len); free((void*) s); } }, + variableSized.getContent(), boxStr, boxLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void FloatExtentAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Span** slot = reinterpret_cast(st); *slot = nullptr; }, aggregationState); +} + +size_t FloatExtentAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Span*); +} + +void FloatExtentAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Span** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterFloatExtentAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("FLOAT_EXTENT aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/FloatUnionAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/FloatUnionAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..834ad56df4 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/FloatUnionAggregationPhysicalFunction.cpp @@ -0,0 +1,166 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_floatunion_mutex; + + +FloatUnionAggregationPhysicalFunction::FloatUnionAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void FloatUnionAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental Set accumulator slot: each event folds its value into the + // running set; O(1)-amortized state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double val) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_floatunion_mutex); + Set** slot = reinterpret_cast(st); + *slot = float_union_transfn(*slot, val); + }, + aggregationState, value); +} + +void FloatUnionAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_floatunion_mutex); + Set** slot1 = reinterpret_cast(s1); + Set** slot2 = reinterpret_cast(s2); + if (!*slot2) { return; } + // set_union_transfn appends slot2's values into slot1 (creates from + // slot2 if slot1 is null); slot2 is freed by its own cleanup. + *slot1 = set_union_transfn(*slot1, *slot2); + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record FloatUnionAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto setStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_floatunion_mutex); + Set** slot = reinterpret_cast(st); + if (!*slot) { return (char*) nullptr; } + // set_union_finalfn consumes (frees) the state and returns the + // deduplicated, sorted Set; the slot must not be freed again. + Set* fin = set_union_finalfn(*slot); + *slot = nullptr; + if (!fin) { return (char*) nullptr; } + char* out = floatset_out(fin, 15); + free(fin); + return out; + }, + aggregationState); + + const auto setLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, setStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(setLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { if (s) { memcpy(dest, s, len); free((void*) s); } }, + variableSized.getContent(), setStr, setLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void FloatUnionAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Set** slot = reinterpret_cast(st); *slot = nullptr; }, aggregationState); +} + +size_t FloatUnionAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Set*); +} + +void FloatUnionAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Set** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterFloatUnionAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("FLOAT_UNION aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/IntExtentAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/IntExtentAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..eab087f011 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/IntExtentAggregationPhysicalFunction.cpp @@ -0,0 +1,163 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_intextent_mutex; + + +IntExtentAggregationPhysicalFunction::IntExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void IntExtentAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental Span accumulator slot: each event folds into the running span; + // O(1) state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int32_t val) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_intextent_mutex); + Span** slot = reinterpret_cast(st); + *slot = int_extent_transfn(*slot, val); + }, + aggregationState, value); +} + +void IntExtentAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_intextent_mutex); + Span** slot1 = reinterpret_cast(s1); + Span** slot2 = reinterpret_cast(s2); + if (!*slot2) { return; } + if (!*slot1) { *slot1 = span_copy(*slot2); return; } + Span* merged = super_union_span_span(*slot1, *slot2, false); + free(*slot1); + *slot1 = merged; + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record IntExtentAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto boxStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_intextent_mutex); + Span** slot = reinterpret_cast(st); + if (!*slot) { return (char*) nullptr; } + char* out = intspan_out(*slot); + free(*slot); + *slot = nullptr; + return out; + }, + aggregationState); + + const auto boxLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, boxStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { if (s) { memcpy(dest, s, len); free((void*) s); } }, + variableSized.getContent(), boxStr, boxLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void IntExtentAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Span** slot = reinterpret_cast(st); *slot = nullptr; }, aggregationState); +} + +size_t IntExtentAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Span*); +} + +void IntExtentAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Span** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterIntExtentAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("INT_EXTENT aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/IntUnionAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/IntUnionAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..9b882ca166 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/IntUnionAggregationPhysicalFunction.cpp @@ -0,0 +1,166 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_intunion_mutex; + + +IntUnionAggregationPhysicalFunction::IntUnionAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void IntUnionAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental Set accumulator slot: each event folds its value into the + // running set; O(1)-amortized state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int32_t val) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_intunion_mutex); + Set** slot = reinterpret_cast(st); + *slot = int_union_transfn(*slot, val); + }, + aggregationState, value); +} + +void IntUnionAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_intunion_mutex); + Set** slot1 = reinterpret_cast(s1); + Set** slot2 = reinterpret_cast(s2); + if (!*slot2) { return; } + // set_union_transfn appends slot2's values into slot1 (creates from + // slot2 if slot1 is null); slot2 is freed by its own cleanup. + *slot1 = set_union_transfn(*slot1, *slot2); + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record IntUnionAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto setStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_intunion_mutex); + Set** slot = reinterpret_cast(st); + if (!*slot) { return (char*) nullptr; } + // set_union_finalfn consumes (frees) the state and returns the + // deduplicated, sorted Set; the slot must not be freed again. + Set* fin = set_union_finalfn(*slot); + *slot = nullptr; + if (!fin) { return (char*) nullptr; } + char* out = intset_out(fin); + free(fin); + return out; + }, + aggregationState); + + const auto setLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, setStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(setLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { if (s) { memcpy(dest, s, len); free((void*) s); } }, + variableSized.getContent(), setStr, setLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void IntUnionAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Set** slot = reinterpret_cast(st); *slot = nullptr; }, aggregationState); +} + +size_t IntUnionAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Set*); +} + +void IntUnionAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Set** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterIntUnionAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("INT_UNION aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/PairMeetingAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/PairMeetingAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..5f50dd33ed --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/PairMeetingAggregationPhysicalFunction.cpp @@ -0,0 +1,312 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; +constexpr static std::string_view VehicleIdFieldName = "vehicle_id"; + +static std::mutex pair_meeting_mutex; + +PairMeetingAggregationPhysicalFunction::PairMeetingAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + PhysicalFunction vehicleIdFunctionParam, + double dMeetMetres, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) + , vehicleIdFunction(std::move(vehicleIdFunctionParam)) + , dMeetMetres(dMeetMetres) +{ +} + +void PairMeetingAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + auto vehicleIdValue = vehicleIdFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue}, + {std::string(VehicleIdFieldName), vehicleIdValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void PairMeetingAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record PairMeetingAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + // Allocate an empty result buffer up-front; the lower step will fill it during the + // single pass over the PagedVector entries. + auto pairsBuffer = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + // Worst case: every vehicle pair could meet. Pre-allocate ~80 bytes per emitted + // pair (BerlinMOD vehicle counts at the scaffold scale never exceed double digits + // per window, so this is a safe upper bound). + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 64; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + return buffer; + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + // Empty window — emit empty string + auto emptyLen = nautilus::val(0); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(emptyLen); + nautilus::invoke(+[](char* buffer) -> void { free(buffer); }, pairsBuffer); + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; + } + + // Walk every entry; the lambda maintains a per-vehicle latest-position map. + // (Nautilus invoke ABI requires that all state be passed through pointer args; we + // model the map as a plain std::unordered_map> allocated + // via new and threaded as a void* through the invoke calls.) + auto vehicleMapPtr = nautilus::invoke( + +[]() -> void* + { + return new std::unordered_map>(); + }); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + const auto vehicleIdValue = itemRecord.read(std::string(VehicleIdFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + auto vehicleId = vehicleIdValue.cast>(); + + nautilus::invoke( + +[](void* mapPtr, double lonVal, double latVal, int64_t tsVal, uint64_t vid) -> void + { + auto* map = static_cast>*>(mapPtr); + // Overwrite-on-insert => map ends up holding the LATEST event per vehicle + // (since the PagedVector iteration preserves insertion order). + (*map)[vid] = std::make_tuple(lonVal, latVal, tsVal); + }, + vehicleMapPtr, lon, lat, timestamp, vehicleId); + } + + // Now enumerate pairs and check geog_dwithin(a, b, dMeet). + // dMeet is passed in via the captureless lambda's arg list (Nautilus invoke ABI + // forbids closures; we thread the threshold through alongside the state pointers). + nautilus::invoke( + +[](void* mapPtr, char* outBuffer, double dMeet) -> void + { + std::lock_guard lock(pair_meeting_mutex); + auto* map = static_cast>*>(mapPtr); + + // Stable iteration order + std::vector vids; + vids.reserve(map->size()); + for (const auto& kv : *map) + { + vids.push_back(kv.first); + } + std::sort(vids.begin(), vids.end()); + + bool first = true; + for (size_t i = 0; i + 1 < vids.size(); ++i) + { + for (size_t j = i + 1; j < vids.size(); ++j) + { + const auto& [lonA, latA, tsA] = (*map)[vids[i]]; + const auto& [lonB, latB, tsB] = (*map)[vids[j]]; + + char wktA[80]; + char wktB[80]; + snprintf(wktA, sizeof(wktA), "SRID=4326;Point(%.7f %.7f)", lonA, latA); + snprintf(wktB, sizeof(wktB), "SRID=4326;Point(%.7f %.7f)", lonB, latB); + GSERIALIZED* gA = geom_in(wktA, -1); + GSERIALIZED* gB = geom_in(wktB, -1); + if (gA == nullptr || gB == nullptr) { + if (gA) free(gA); + if (gB) free(gB); + continue; + } + GSERIALIZED* ggA = geom_to_geog(gA); + GSERIALIZED* ggB = geom_to_geog(gB); + bool meets = geog_dwithin(ggA, ggB, dMeet, true); + if (meets) { + // Use the later of the two timestamps as the meeting time + int64_t tsMax = (tsA > tsB) ? tsA : tsB; + // Approximate distance via geog distance (not exposed in meos_geo here yet); + // emit (vidA, vidB, ts, "≤dMeet") triple + char buf[128]; + snprintf(buf, sizeof(buf), "%s%lu,%lu,%lld,<=%.1f", + first ? "" : ";", + (unsigned long)vids[i], (unsigned long)vids[j], + (long long)tsMax, + dMeet); + strcat(outBuffer, buf); + first = false; + } + free(ggA); + free(ggB); + free(gA); + free(gB); + } + } + delete map; + }, + vehicleMapPtr, pairsBuffer, nautilus::val(dMeetMetres)); + + // Allocate VARSIZED output sized to the assembled string + auto strLen = nautilus::invoke( + +[](const char* buffer) -> size_t { return strlen(buffer); }, + pairsBuffer); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(strLen); + nautilus::invoke( + +[](int8_t* dest, const char* src, size_t len) -> void + { + if (len > 0) memcpy(dest, src, len); + free((void*)src); + }, + variableSized.getContent(), pairsBuffer, strLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void PairMeetingAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t PairMeetingAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void PairMeetingAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast( + pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterPairMeetingAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("PAIR_MEETING aggregation cannot be created through the registry. " + "It requires four field functions (longitude, latitude, timestamp, vehicle_id)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TLengthExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TLengthExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..7deea97710 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TLengthExpAggregationPhysicalFunction.cpp @@ -0,0 +1,205 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tlengthexp_mutex; + + +TLengthExpAggregationPhysicalFunction::TLengthExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TLengthExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tlengthexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TLengthExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tlengthexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TLengthExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto resultValue = nautilus::invoke( + +[](AggregationState* st) -> double + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tlengthexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (double)0; + } + return tpoint_length(*slot); + }, + aggregationState); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TLengthExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TLengthExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TLengthExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTLengthExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TLENGTH_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalAtMaxExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalAtMaxExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..d3ddb1e1e5 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalAtMaxExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_temporalatmaxexp_mutex; + + +TemporalAtMaxExpAggregationPhysicalFunction::TemporalAtMaxExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalAtMaxExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalatmaxexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TemporalAtMaxExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalatmaxexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TemporalAtMaxExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalatmaxexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = temporal_at_max(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TemporalAtMaxExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TemporalAtMaxExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TemporalAtMaxExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalAtMaxExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TEMPORAL_AT_MAX_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalAtMinExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalAtMinExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..97aea52ab8 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalAtMinExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_temporalatminexp_mutex; + + +TemporalAtMinExpAggregationPhysicalFunction::TemporalAtMinExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalAtMinExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalatminexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TemporalAtMinExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalatminexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TemporalAtMinExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalatminexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = temporal_at_min(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TemporalAtMinExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TemporalAtMinExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TemporalAtMinExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalAtMinExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TEMPORAL_AT_MIN_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalCopyExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalCopyExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..36bce80b67 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalCopyExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_temporalcopyexp_mutex; + + +TemporalCopyExpAggregationPhysicalFunction::TemporalCopyExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalCopyExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalcopyexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TemporalCopyExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalcopyexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TemporalCopyExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalcopyexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = temporal_copy(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TemporalCopyExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TemporalCopyExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TemporalCopyExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalCopyExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TEMPORAL_COPY_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalDerivativeExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalDerivativeExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..4cf29ed8c9 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalDerivativeExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_temporalderivativeexp_mutex; + + +TemporalDerivativeExpAggregationPhysicalFunction::TemporalDerivativeExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalDerivativeExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalderivativeexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TemporalDerivativeExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalderivativeexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TemporalDerivativeExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalderivativeexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = temporal_derivative(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TemporalDerivativeExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TemporalDerivativeExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TemporalDerivativeExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalDerivativeExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TEMPORAL_DERIVATIVE_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalEndTimestampAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalEndTimestampAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..d5858b5453 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalEndTimestampAggregationPhysicalFunction.cpp @@ -0,0 +1,261 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporalendtimestamp_mutex; + + +TemporalEndTimestampAggregationPhysicalFunction::TemporalEndTimestampAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalEndTimestampAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalEndTimestampAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalEndTimestampAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> int64_t + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (int64_t)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalendtimestamp_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return (int64_t)0; + } + + int64_t value = temporal_end_timestamptz(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalEndTimestampAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalEndTimestampAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalEndTimestampAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalEndTimestampAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalEndTimestamp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalLengthAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalLengthAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..924b8cba1f --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalLengthAggregationPhysicalFunction.cpp @@ -0,0 +1,272 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// MEOS wrapper header + geo extension symbols for tpoint_length +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +// Mutex for thread-safe MEOS operations +static std::mutex meos_length_mutex; + + +TemporalLengthAggregationPhysicalFunction::TemporalLengthAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalLengthAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalLengthAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalLengthAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + // Handle empty PagedVector case — zero-length trajectory + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0.0)); + return resultRecord; + } + + // Build the trajectory string in the same MEOS instant-set format that + // TemporalSequenceAggregationPhysicalFunction uses: {Point(lon lat)@ts, ...} + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + // Parse the assembled trajectory into a MEOS Temporal object, call + // tpoint_length on it, and free both the C string and the Temporal. + auto totalLength = nautilus::invoke( + +[](const char* trajStr) -> double + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return 0.0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_length_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return 0.0; + } + + // tpoint_length is the MEOS C symbol from meos_geo.h. It returns the + // spheroidal length in the SRID's distance unit (metres for the + // BerlinMOD WGS84 trajectories that the scaffold streams). + double length = tpoint_length(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return length; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, totalLength); + return resultRecord; +} + +void TemporalLengthAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalLengthAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalLengthAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast( + pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalLengthAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TEMPORAL_LENGTH aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalLowerIncAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalLowerIncAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..81a3339a7a --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalLowerIncAggregationPhysicalFunction.cpp @@ -0,0 +1,261 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporallowerinc_mutex; + + +TemporalLowerIncAggregationPhysicalFunction::TemporalLowerIncAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalLowerIncAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalLowerIncAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalLowerIncAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> bool + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (bool)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporallowerinc_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return (bool)0; + } + + bool value = temporal_lower_inc(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalLowerIncAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalLowerIncAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalLowerIncAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalLowerIncAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalLowerInc aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalMinusMaxExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalMinusMaxExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..2cadbdac98 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalMinusMaxExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_temporalminusmaxexp_mutex; + + +TemporalMinusMaxExpAggregationPhysicalFunction::TemporalMinusMaxExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalMinusMaxExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalminusmaxexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TemporalMinusMaxExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalminusmaxexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TemporalMinusMaxExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalminusmaxexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = temporal_minus_max(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TemporalMinusMaxExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TemporalMinusMaxExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TemporalMinusMaxExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalMinusMaxExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TEMPORAL_MINUS_MAX_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalMinusMinExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalMinusMinExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..971109d0c9 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalMinusMinExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_temporalminusminexp_mutex; + + +TemporalMinusMinExpAggregationPhysicalFunction::TemporalMinusMinExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalMinusMinExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalminusminexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TemporalMinusMinExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalminusminexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TemporalMinusMinExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalminusminexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = temporal_minus_min(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TemporalMinusMinExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TemporalMinusMinExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TemporalMinusMinExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalMinusMinExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TEMPORAL_MINUS_MIN_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumInstantsAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumInstantsAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..def790e5fc --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumInstantsAggregationPhysicalFunction.cpp @@ -0,0 +1,261 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporalnuminstants_mutex; + + +TemporalNumInstantsAggregationPhysicalFunction::TemporalNumInstantsAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalNumInstantsAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalNumInstantsAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalNumInstantsAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> int + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (int)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalnuminstants_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return (int)0; + } + + int value = temporal_num_instants(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalNumInstantsAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalNumInstantsAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalNumInstantsAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalNumInstantsAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalNumInstants aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumSequencesAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumSequencesAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..b05335d2f1 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumSequencesAggregationPhysicalFunction.cpp @@ -0,0 +1,261 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporalnumsequences_mutex; + + +TemporalNumSequencesAggregationPhysicalFunction::TemporalNumSequencesAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalNumSequencesAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalNumSequencesAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalNumSequencesAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> int + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (int)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalnumsequences_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return (int)0; + } + + int value = temporal_num_sequences(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalNumSequencesAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalNumSequencesAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalNumSequencesAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalNumSequencesAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalNumSequences aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumTimestampsAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumTimestampsAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..0e3eba8dd6 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalNumTimestampsAggregationPhysicalFunction.cpp @@ -0,0 +1,261 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporalnumtimestamps_mutex; + + +TemporalNumTimestampsAggregationPhysicalFunction::TemporalNumTimestampsAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalNumTimestampsAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalNumTimestampsAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalNumTimestampsAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> int + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (int)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalnumtimestamps_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return (int)0; + } + + int value = temporal_num_timestamps(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalNumTimestampsAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalNumTimestampsAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalNumTimestampsAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalNumTimestampsAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalNumTimestamps aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalStartTimestampAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalStartTimestampAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..10e030cf24 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalStartTimestampAggregationPhysicalFunction.cpp @@ -0,0 +1,261 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporalstarttimestamp_mutex; + + +TemporalStartTimestampAggregationPhysicalFunction::TemporalStartTimestampAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalStartTimestampAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalStartTimestampAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalStartTimestampAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> int64_t + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (int64_t)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalstarttimestamp_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return (int64_t)0; + } + + int64_t value = temporal_start_timestamptz(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalStartTimestampAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalStartTimestampAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalStartTimestampAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalStartTimestampAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalStartTimestamp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatAvgValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatAvgValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..df1fb6b486 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatAvgValueAggregationPhysicalFunction.cpp @@ -0,0 +1,254 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltfloatavgvalue_mutex; + + +TemporalTFloatAvgValueAggregationPhysicalFunction::TemporalTFloatAvgValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTFloatAvgValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTFloatAvgValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTFloatAvgValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, double valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%.6f@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> double + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (double)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltfloatavgvalue_mutex); + + Temporal* temp = tfloat_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (double)0; + } + + /* tfloat_avg_value is declared in meos.h but not defined in libmeos; + use the generic tnumber_avg_value (tfloat is a tnumber), matching + the TInt sibling op. */ + double value = tnumber_avg_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTFloatAvgValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTFloatAvgValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTFloatAvgValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTFloatAvgValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTFloatAvgValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatEndValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatEndValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..1651c5f73c --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatEndValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltfloatendvalue_mutex; + + +TemporalTFloatEndValueAggregationPhysicalFunction::TemporalTFloatEndValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTFloatEndValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTFloatEndValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTFloatEndValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, double valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%.6f@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> double + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (double)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltfloatendvalue_mutex); + + Temporal* temp = tfloat_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (double)0; + } + + double value = tfloat_end_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTFloatEndValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTFloatEndValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTFloatEndValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTFloatEndValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTFloatEndValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatMaxValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatMaxValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..7251c08a06 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatMaxValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltfloatmaxvalue_mutex; + + +TemporalTFloatMaxValueAggregationPhysicalFunction::TemporalTFloatMaxValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTFloatMaxValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTFloatMaxValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTFloatMaxValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, double valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%.6f@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> double + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (double)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltfloatmaxvalue_mutex); + + Temporal* temp = tfloat_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (double)0; + } + + double value = tfloat_max_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTFloatMaxValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTFloatMaxValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTFloatMaxValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTFloatMaxValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTFloatMaxValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatMinValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatMinValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..517d9cd896 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatMinValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltfloatminvalue_mutex; + + +TemporalTFloatMinValueAggregationPhysicalFunction::TemporalTFloatMinValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTFloatMinValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTFloatMinValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTFloatMinValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, double valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%.6f@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> double + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (double)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltfloatminvalue_mutex); + + Temporal* temp = tfloat_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (double)0; + } + + double value = tfloat_min_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTFloatMinValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTFloatMinValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTFloatMinValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTFloatMinValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTFloatMinValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatStartValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatStartValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..3beefc0d10 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTFloatStartValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltfloatstartvalue_mutex; + + +TemporalTFloatStartValueAggregationPhysicalFunction::TemporalTFloatStartValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTFloatStartValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTFloatStartValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTFloatStartValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, double valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%.6f@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> double + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (double)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltfloatstartvalue_mutex); + + Temporal* temp = tfloat_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (double)0; + } + + double value = tfloat_start_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTFloatStartValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTFloatStartValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTFloatStartValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTFloatStartValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTFloatStartValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntAvgValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntAvgValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..1637d7ea8c --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntAvgValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltintavgvalue_mutex; + + +TemporalTIntAvgValueAggregationPhysicalFunction::TemporalTIntAvgValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTIntAvgValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTIntAvgValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTIntAvgValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, int32_t valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%d@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> double + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (double)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltintavgvalue_mutex); + + Temporal* temp = tint_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (double)0; + } + + double value = tnumber_avg_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTIntAvgValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTIntAvgValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTIntAvgValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTIntAvgValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTIntAvgValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntEndValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntEndValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..f27b535976 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntEndValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltintendvalue_mutex; + + +TemporalTIntEndValueAggregationPhysicalFunction::TemporalTIntEndValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTIntEndValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTIntEndValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTIntEndValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, int32_t valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%d@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> int + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (int)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltintendvalue_mutex); + + Temporal* temp = tint_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (int)0; + } + + int value = tint_end_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTIntEndValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTIntEndValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTIntEndValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTIntEndValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTIntEndValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntMaxValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntMaxValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..e59d2357dd --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntMaxValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltintmaxvalue_mutex; + + +TemporalTIntMaxValueAggregationPhysicalFunction::TemporalTIntMaxValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTIntMaxValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTIntMaxValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTIntMaxValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, int32_t valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%d@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> int + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (int)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltintmaxvalue_mutex); + + Temporal* temp = tint_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (int)0; + } + + int value = tint_max_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTIntMaxValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTIntMaxValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTIntMaxValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTIntMaxValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTIntMaxValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntMinValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntMinValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..983481cc32 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntMinValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltintminvalue_mutex; + + +TemporalTIntMinValueAggregationPhysicalFunction::TemporalTIntMinValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTIntMinValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTIntMinValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTIntMinValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, int32_t valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%d@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> int + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (int)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltintminvalue_mutex); + + Temporal* temp = tint_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (int)0; + } + + int value = tint_min_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTIntMinValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTIntMinValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTIntMinValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTIntMinValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTIntMinValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntStartValueAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntStartValueAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..97d5269735 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTIntStartValueAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltintstartvalue_mutex; + + +TemporalTIntStartValueAggregationPhysicalFunction::TemporalTIntStartValueAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTIntStartValueAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTIntStartValueAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTIntStartValueAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, int32_t valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%d@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> int + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (int)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltintstartvalue_mutex); + + Temporal* temp = tint_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (int)0; + } + + int value = tint_start_value(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTIntStartValueAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTIntStartValueAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTIntStartValueAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTIntStartValueAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTIntStartValue aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTNumberIntegralAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTNumberIntegralAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..9773f461d7 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTNumberIntegralAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltnumberintegral_mutex; + + +TemporalTNumberIntegralAggregationPhysicalFunction::TemporalTNumberIntegralAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTNumberIntegralAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTNumberIntegralAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTNumberIntegralAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, double valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%.6f@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> double + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (double)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltnumberintegral_mutex); + + Temporal* temp = tfloat_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (double)0; + } + + double value = tnumber_integral(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTNumberIntegralAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTNumberIntegralAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTNumberIntegralAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTNumberIntegralAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTNumberIntegral aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTNumberTwAvgAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTNumberTwAvgAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..64f61bda2f --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTNumberTwAvgAggregationPhysicalFunction.cpp @@ -0,0 +1,251 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltnumbertwavg_mutex; + + +TemporalTNumberTwAvgAggregationPhysicalFunction::TemporalTNumberTwAvgAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTNumberTwAvgAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(ValueFieldName), valueValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTNumberTwAvgAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTNumberTwAvgAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, double valueVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "%.6f@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> double + { + if (!seqStr || strlen(seqStr) == 0) { + free((void*)seqStr); + return (double)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltnumbertwavg_mutex); + + Temporal* temp = tfloat_in(seqStr); + if (!temp) { + free((void*)seqStr); + return (double)0; + } + + double value = tnumber_twavg(temp); + + free(temp); + free((void*)seqStr); + return value; + }, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTNumberTwAvgAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTNumberTwAvgAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTNumberTwAvgAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTNumberTwAvgAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTNumberTwAvg aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTPointIsSimpleAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTPointIsSimpleAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..6a311563f2 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalTPointIsSimpleAggregationPhysicalFunction.cpp @@ -0,0 +1,261 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporaltpointissimple_mutex; + + +TemporalTPointIsSimpleAggregationPhysicalFunction::TemporalTPointIsSimpleAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalTPointIsSimpleAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalTPointIsSimpleAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalTPointIsSimpleAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> bool + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (bool)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporaltpointissimple_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return (bool)0; + } + + bool value = tpoint_is_simple(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalTPointIsSimpleAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalTPointIsSimpleAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalTPointIsSimpleAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalTPointIsSimpleAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalTPointIsSimple aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TemporalUpperIncAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalUpperIncAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..a482086f6b --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TemporalUpperIncAggregationPhysicalFunction.cpp @@ -0,0 +1,261 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_temporalupperinc_mutex; + + +TemporalUpperIncAggregationPhysicalFunction::TemporalUpperIncAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TemporalUpperIncAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TemporalUpperIncAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TemporalUpperIncAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val(0)); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{"); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "}"); + return buffer; + }, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> bool + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (bool)0; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_temporalupperinc_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) { + free((void*)trajStr); + return (bool)0; + } + + bool value = temporal_upper_inc(static_cast(temp)); + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +} + +void TemporalUpperIncAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TemporalUpperIncAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TemporalUpperIncAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTemporalUpperIncAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TemporalUpperInc aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TgeoCentroidExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TgeoCentroidExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..132a759361 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TgeoCentroidExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tgeocentroidexp_mutex; + + +TgeoCentroidExpAggregationPhysicalFunction::TgeoCentroidExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TgeoCentroidExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeocentroidexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TgeoCentroidExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeocentroidexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TgeoCentroidExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeocentroidexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tgeo_centroid(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TgeoCentroidExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TgeoCentroidExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TgeoCentroidExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTgeoCentroidExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TGEO_CENTROID_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TgeoConvexHullExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TgeoConvexHullExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..13079a7452 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TgeoConvexHullExpAggregationPhysicalFunction.cpp @@ -0,0 +1,229 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tgeoconvexhullexp_mutex; + + +TgeoConvexHullExpAggregationPhysicalFunction::TgeoConvexHullExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TgeoConvexHullExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeoconvexhullexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TgeoConvexHullExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeoconvexhullexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TgeoConvexHullExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeoconvexhullexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + GSERIALIZED* res = tgeo_convex_hull(*slot); + if (!res) { + return (char*)nullptr; + } + char* hexOut = geo_out(res); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TgeoConvexHullExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TgeoConvexHullExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TgeoConvexHullExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTgeoConvexHullExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TgeoConvexHullExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TgeoEndValueExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TgeoEndValueExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..05edaf2aad --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TgeoEndValueExpAggregationPhysicalFunction.cpp @@ -0,0 +1,229 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tgeoendvalueexp_mutex; + + +TgeoEndValueExpAggregationPhysicalFunction::TgeoEndValueExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TgeoEndValueExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeoendvalueexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TgeoEndValueExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeoendvalueexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TgeoEndValueExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeoendvalueexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + GSERIALIZED* res = tgeo_end_value(*slot); + if (!res) { + return (char*)nullptr; + } + char* hexOut = geo_out(res); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TgeoEndValueExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TgeoEndValueExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TgeoEndValueExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTgeoEndValueExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TgeoEndValueExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TgeoStartValueExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TgeoStartValueExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..057e6803eb --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TgeoStartValueExpAggregationPhysicalFunction.cpp @@ -0,0 +1,229 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tgeostartvalueexp_mutex; + + +TgeoStartValueExpAggregationPhysicalFunction::TgeoStartValueExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TgeoStartValueExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeostartvalueexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TgeoStartValueExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeostartvalueexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TgeoStartValueExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeostartvalueexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + GSERIALIZED* res = tgeo_start_value(*slot); + if (!res) { + return (char*)nullptr; + } + char* hexOut = geo_out(res); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TgeoStartValueExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TgeoStartValueExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TgeoStartValueExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTgeoStartValueExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TgeoStartValueExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TgeompointToTgeometryExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TgeompointToTgeometryExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..1bed4c9c4f --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TgeompointToTgeometryExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tgeompointtotgeometryexp_mutex; + + +TgeompointToTgeometryExpAggregationPhysicalFunction::TgeompointToTgeometryExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TgeompointToTgeometryExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeompointtotgeometryexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TgeompointToTgeometryExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeompointtotgeometryexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TgeompointToTgeometryExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tgeompointtotgeometryexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tgeompoint_to_tgeometry(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TgeompointToTgeometryExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TgeompointToTgeometryExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TgeompointToTgeometryExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTgeompointToTgeometryExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TGEOMPOINT_TO_TGEOMETRY_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TimestamptzExtentAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TimestamptzExtentAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..f73acbbbb0 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TimestamptzExtentAggregationPhysicalFunction.cpp @@ -0,0 +1,165 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_timestamptzextent_mutex; + + +TimestamptzExtentAggregationPhysicalFunction::TimestamptzExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TimestamptzExtentAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental Span accumulator slot: each event folds into the running span; + // O(1) state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int64_t val) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_timestamptzextent_mutex); + Span** slot = reinterpret_cast(st); + long long sec = (val > 1000000000000LL) ? (val / 1000) : val; + TimestampTz tstz = ((int64_t) sec - 946684800LL) * 1000000LL; + *slot = timestamptz_extent_transfn(*slot, tstz); + }, + aggregationState, value); +} + +void TimestamptzExtentAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_timestamptzextent_mutex); + Span** slot1 = reinterpret_cast(s1); + Span** slot2 = reinterpret_cast(s2); + if (!*slot2) { return; } + if (!*slot1) { *slot1 = span_copy(*slot2); return; } + Span* merged = super_union_span_span(*slot1, *slot2, false); + free(*slot1); + *slot1 = merged; + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record TimestamptzExtentAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto boxStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_timestamptzextent_mutex); + Span** slot = reinterpret_cast(st); + if (!*slot) { return (char*) nullptr; } + char* out = tstzspan_out(*slot); + free(*slot); + *slot = nullptr; + return out; + }, + aggregationState); + + const auto boxLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, boxStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { if (s) { memcpy(dest, s, len); free((void*) s); } }, + variableSized.getContent(), boxStr, boxLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TimestamptzExtentAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Span** slot = reinterpret_cast(st); *slot = nullptr; }, aggregationState); +} + +size_t TimestamptzExtentAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Span*); +} + +void TimestamptzExtentAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Span** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTimestamptzExtentAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TIMESTAMPTZ_EXTENT aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TimestamptzUnionAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TimestamptzUnionAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..d9c777e047 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TimestamptzUnionAggregationPhysicalFunction.cpp @@ -0,0 +1,168 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_timestamptzunion_mutex; + + +TimestamptzUnionAggregationPhysicalFunction::TimestamptzUnionAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TimestamptzUnionAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental Set accumulator slot: each event folds its value into the + // running set; O(1)-amortized state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int64_t val) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_timestamptzunion_mutex); + Set** slot = reinterpret_cast(st); + long long sec = (val > 1000000000000LL) ? (val / 1000) : val; + TimestampTz tstz = ((int64_t) sec - 946684800LL) * 1000000LL; + *slot = timestamptz_union_transfn(*slot, tstz); + }, + aggregationState, value); +} + +void TimestamptzUnionAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_timestamptzunion_mutex); + Set** slot1 = reinterpret_cast(s1); + Set** slot2 = reinterpret_cast(s2); + if (!*slot2) { return; } + // set_union_transfn appends slot2's values into slot1 (creates from + // slot2 if slot1 is null); slot2 is freed by its own cleanup. + *slot1 = set_union_transfn(*slot1, *slot2); + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record TimestamptzUnionAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto setStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_timestamptzunion_mutex); + Set** slot = reinterpret_cast(st); + if (!*slot) { return (char*) nullptr; } + // set_union_finalfn consumes (frees) the state and returns the + // deduplicated, sorted Set; the slot must not be freed again. + Set* fin = set_union_finalfn(*slot); + *slot = nullptr; + if (!fin) { return (char*) nullptr; } + char* out = tstzset_out(fin); + free(fin); + return out; + }, + aggregationState); + + const auto setLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, setStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(setLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { if (s) { memcpy(dest, s, len); free((void*) s); } }, + variableSized.getContent(), setStr, setLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TimestamptzUnionAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Set** slot = reinterpret_cast(st); *slot = nullptr; }, aggregationState); +} + +size_t TimestamptzUnionAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Set*); +} + +void TimestamptzUnionAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke(+[](AggregationState* st) -> void + { Set** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTimestamptzUnionAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TIMESTAMPTZ_UNION aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TnpointCumulativeLengthExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TnpointCumulativeLengthExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..abc0ba18f9 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TnpointCumulativeLengthExpAggregationPhysicalFunction.cpp @@ -0,0 +1,228 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tnpointcumulativelengthexp_mutex; + + +TnpointCumulativeLengthExpAggregationPhysicalFunction::TnpointCumulativeLengthExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TnpointCumulativeLengthExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto ridValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto fracValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto rid = ridValue.cast>(); + auto frac = fracValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int64_t ridVal, double fracVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointcumulativelengthexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "NPoint(%lld,%.6f)@%s", (long long) ridVal, fracVal, ts.c_str()); + + Temporal* instTemp = tnpoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + rid, + frac, + timestamp); +} + +void TnpointCumulativeLengthExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointcumulativelengthexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TnpointCumulativeLengthExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointcumulativelengthexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tnpoint_cumulative_length(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TnpointCumulativeLengthExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TnpointCumulativeLengthExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TnpointCumulativeLengthExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTnpointCumulativeLengthExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TNPOINT_CUMULATIVE_LENGTH_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TnpointSpeedExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TnpointSpeedExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..c3a708f193 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TnpointSpeedExpAggregationPhysicalFunction.cpp @@ -0,0 +1,228 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tnpointspeedexp_mutex; + + +TnpointSpeedExpAggregationPhysicalFunction::TnpointSpeedExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TnpointSpeedExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto ridValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto fracValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto rid = ridValue.cast>(); + auto frac = fracValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int64_t ridVal, double fracVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointspeedexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "NPoint(%lld,%.6f)@%s", (long long) ridVal, fracVal, ts.c_str()); + + Temporal* instTemp = tnpoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + rid, + frac, + timestamp); +} + +void TnpointSpeedExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointspeedexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TnpointSpeedExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointspeedexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tnpoint_speed(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TnpointSpeedExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TnpointSpeedExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TnpointSpeedExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTnpointSpeedExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TNPOINT_SPEED_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TnpointToTgeompointExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TnpointToTgeompointExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..12718ca84f --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TnpointToTgeompointExpAggregationPhysicalFunction.cpp @@ -0,0 +1,228 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tnpointtotgeompointexp_mutex; + + +TnpointToTgeompointExpAggregationPhysicalFunction::TnpointToTgeompointExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TnpointToTgeompointExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto ridValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto fracValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto rid = ridValue.cast>(); + auto frac = fracValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int64_t ridVal, double fracVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointtotgeompointexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "NPoint(%lld,%.6f)@%s", (long long) ridVal, fracVal, ts.c_str()); + + Temporal* instTemp = tnpoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + rid, + frac, + timestamp); +} + +void TnpointToTgeompointExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointtotgeompointexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TnpointToTgeompointExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnpointtotgeompointexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tnpoint_to_tgeompoint(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TnpointToTgeompointExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TnpointToTgeompointExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TnpointToTgeompointExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTnpointToTgeompointExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TNPOINT_TO_TGEOMPOINT_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TnumberAbsExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberAbsExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..4ab77bbbcc --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberAbsExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tnumberabsexp_mutex; + + +TnumberAbsExpAggregationPhysicalFunction::TnumberAbsExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TnumberAbsExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberabsexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TnumberAbsExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberabsexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TnumberAbsExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberabsexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tnumber_abs(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TnumberAbsExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TnumberAbsExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TnumberAbsExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTnumberAbsExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TNUMBER_ABS_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TnumberAngularDifferenceExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberAngularDifferenceExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..23ae8e353e --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberAngularDifferenceExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tnumberangulardifferenceexp_mutex; + + +TnumberAngularDifferenceExpAggregationPhysicalFunction::TnumberAngularDifferenceExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TnumberAngularDifferenceExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberangulardifferenceexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TnumberAngularDifferenceExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberangulardifferenceexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TnumberAngularDifferenceExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberangulardifferenceexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tnumber_angular_difference(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TnumberAngularDifferenceExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TnumberAngularDifferenceExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TnumberAngularDifferenceExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTnumberAngularDifferenceExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TNUMBER_ANGULAR_DIFFERENCE_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TnumberDeltaValueExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberDeltaValueExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..d697591f5d --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberDeltaValueExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tnumberdeltavalueexp_mutex; + + +TnumberDeltaValueExpAggregationPhysicalFunction::TnumberDeltaValueExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TnumberDeltaValueExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberdeltavalueexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TnumberDeltaValueExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberdeltavalueexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TnumberDeltaValueExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberdeltavalueexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tnumber_delta_value(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TnumberDeltaValueExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TnumberDeltaValueExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TnumberDeltaValueExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTnumberDeltaValueExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TNUMBER_DELTA_VALUE_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TnumberExtentAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberExtentAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..d43fd4feaa --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberExtentAggregationPhysicalFunction.cpp @@ -0,0 +1,189 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +} + +namespace NES +{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_tnumberextent_mutex; + + +TnumberExtentAggregationPhysicalFunction::TnumberExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TnumberExtentAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental accumulator slot: each event folds into the running value/time + // TBox via tnumber_extent_transfn. O(1) state, no event buffer. + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberextent_mutex); + TBox** slot = reinterpret_cast(st); + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[64]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + Temporal* inst = tfloat_in(wkt); + if (!inst) { + return; + } + *slot = tnumber_extent_transfn(*slot, inst); + free(inst); + }, + aggregationState, value, timestamp); +} + +void TnumberExtentAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumberextent_mutex); + TBox** slot1 = reinterpret_cast(s1); + TBox** slot2 = reinterpret_cast(s2); + if (!*slot2) { + return; + } + if (!*slot1) { + *slot1 = tbox_copy(*slot2); + return; + } + TBox* merged = union_tbox_tbox(*slot1, *slot2, false); + free(*slot1); + *slot1 = merged; + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record TnumberExtentAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto boxStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_tnumberextent_mutex); + TBox** slot = reinterpret_cast(st); + if (!*slot) { + return (char*) nullptr; + } + char* out = tbox_out(*slot, 15); + free(*slot); + *slot = nullptr; + return out; + }, + aggregationState); + + const auto boxLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, boxStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { memcpy(dest, s, len); free((void*) s); } + }, + variableSized.getContent(), boxStr, boxLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TnumberExtentAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { TBox** slot = reinterpret_cast(st); *slot = nullptr; }, + aggregationState); +} + +size_t TnumberExtentAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(TBox*); +} + +void TnumberExtentAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { TBox** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, + aggregationState); +} + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTnumberExtentAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TNUMBER_EXTENT aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TnumberTrendExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberTrendExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..9f9a075a90 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TnumberTrendExpAggregationPhysicalFunction.cpp @@ -0,0 +1,223 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tnumbertrendexp_mutex; + + +TnumberTrendExpAggregationPhysicalFunction::TnumberTrendExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TnumberTrendExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumbertrendexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); + }, + aggregationState, + value, + timestamp); +} + +void TnumberTrendExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumbertrendexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TnumberTrendExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tnumbertrendexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tnumber_trend(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TnumberTrendExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TnumberTrendExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TnumberTrendExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTnumberTrendExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TnumberTrendExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TpointAngularDifferenceExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TpointAngularDifferenceExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..826179c559 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TpointAngularDifferenceExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tpointangulardifferenceexp_mutex; + + +TpointAngularDifferenceExpAggregationPhysicalFunction::TpointAngularDifferenceExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TpointAngularDifferenceExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointangulardifferenceexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TpointAngularDifferenceExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointangulardifferenceexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TpointAngularDifferenceExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointangulardifferenceexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tpoint_angular_difference(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TpointAngularDifferenceExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TpointAngularDifferenceExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TpointAngularDifferenceExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTpointAngularDifferenceExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TPOINT_ANGULAR_DIFFERENCE_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TpointAzimuthExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TpointAzimuthExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..12dfbfac89 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TpointAzimuthExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tpointazimuthexp_mutex; + + +TpointAzimuthExpAggregationPhysicalFunction::TpointAzimuthExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TpointAzimuthExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointazimuthexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TpointAzimuthExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointazimuthexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TpointAzimuthExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointazimuthexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tpoint_azimuth(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TpointAzimuthExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TpointAzimuthExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TpointAzimuthExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTpointAzimuthExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TPOINT_AZIMUTH_EXP aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TpointCumulativeLengthExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TpointCumulativeLengthExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..9dc367f466 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TpointCumulativeLengthExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tpointcumulativelengthexp_mutex; + + +TpointCumulativeLengthExpAggregationPhysicalFunction::TpointCumulativeLengthExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TpointCumulativeLengthExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointcumulativelengthexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TpointCumulativeLengthExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointcumulativelengthexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TpointCumulativeLengthExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointcumulativelengthexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tpoint_cumulative_length(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TpointCumulativeLengthExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TpointCumulativeLengthExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TpointCumulativeLengthExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTpointCumulativeLengthExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TpointCumulativeLengthExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TpointGetXExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TpointGetXExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..d43cf04d12 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TpointGetXExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tpointgetxexp_mutex; + + +TpointGetXExpAggregationPhysicalFunction::TpointGetXExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TpointGetXExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointgetxexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TpointGetXExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointgetxexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TpointGetXExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointgetxexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tpoint_get_x(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TpointGetXExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TpointGetXExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TpointGetXExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTpointGetXExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TpointGetXExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TpointGetYExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TpointGetYExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..d0a7a3cc52 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TpointGetYExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tpointgetyexp_mutex; + + +TpointGetYExpAggregationPhysicalFunction::TpointGetYExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TpointGetYExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointgetyexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TpointGetYExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointgetyexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TpointGetYExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointgetyexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tpoint_get_y(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TpointGetYExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TpointGetYExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TpointGetYExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTpointGetYExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TpointGetYExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TpointSpeedExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TpointSpeedExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..070c094857 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TpointSpeedExpAggregationPhysicalFunction.cpp @@ -0,0 +1,230 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tpointspeedexp_mutex; + + +TpointSpeedExpAggregationPhysicalFunction::TpointSpeedExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TpointSpeedExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointspeedexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TpointSpeedExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointspeedexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TpointSpeedExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointspeedexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + Temporal* res = tpoint_speed(*slot); + if (!res) { + return (char*)nullptr; + } + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TpointSpeedExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TpointSpeedExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TpointSpeedExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTpointSpeedExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TpointSpeedExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TpointTwcentroidExpAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TpointTwcentroidExpAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..5a96527b0a --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TpointTwcentroidExpAggregationPhysicalFunction.cpp @@ -0,0 +1,229 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +static std::mutex meos_tpointtwcentroidexp_mutex; + + +TpointTwcentroidExpAggregationPhysicalFunction::TpointTwcentroidExpAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TpointTwcentroidExpAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointtwcentroidexp_mutex); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) { + return; + } + if (*slot == nullptr) { + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + } else { + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + } + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }, + aggregationState, + lon, + lat, + timestamp); +} + +void TpointTwcentroidExpAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointtwcentroidexp_mutex); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) { + return; + } + if (*s1 == nullptr) { + *s1 = *s2; + *s2 = nullptr; + return; + } + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }, + aggregationState1, + aggregationState2); +} + +Nautilus::Record TpointTwcentroidExpAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tpointtwcentroidexp_mutex); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) { + return (char*)nullptr; + } + GSERIALIZED* res = tpoint_twcentroid(*slot); + if (!res) { + return (char*)nullptr; + } + char* hexOut = geo_out(res); + free(res); + return hexOut; + }, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TpointTwcentroidExpAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }, + aggregationState); +} + +size_t TpointTwcentroidExpAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Temporal*); +} + +void TpointTwcentroidExpAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) { + free(*slot); + *slot = nullptr; + } + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTpointTwcentroidExpAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TpointTwcentroidExp aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TrajectoryWkbAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TrajectoryWkbAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..8c216f9da3 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TrajectoryWkbAggregationPhysicalFunction.cpp @@ -0,0 +1,279 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_trajectorywkb_mutex; + + +TrajectoryWkbAggregationPhysicalFunction::TrajectoryWkbAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TrajectoryWkbAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({ + {std::string(LonFieldName), lonValue}, + {std::string(LatFieldName), latValue}, + {std::string(TimestampFieldName), timestampValue} + }); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +} + +void TrajectoryWkbAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + { vector1->copyFrom(*vector2); }, + memArea1, + memArea2); +} + +Nautilus::Record TrajectoryWkbAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + { + return pagedVector->getTotalNumberOfEntries(); + }, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) { + auto emptyVarSized = pipelineMemoryProvider.arena.allocateVariableSizedData(0); + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, emptyVarSized); + return resultRecord; + } + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + { + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "["); + return buffer; + }, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + { + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + { + if (counter > 0) { + strcat(buffer, ", "); + } + + long long adjustedTime; + if (tsVal > 1000000000000LL) { + adjustedTime = tsVal / 1000; + } else { + adjustedTime = tsVal; + } + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + } + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + { + strcat(buffer, "]"); + return buffer; + }, + trajectoryStr); + + auto boxStr = nautilus::invoke( + +[](const char* trajStr) -> char* + { + if (!trajStr || strlen(trajStr) == 0) { + free((void*)trajStr); + return (char*)nullptr; + } + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_trajectorywkb_mutex); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + free((void*)trajStr); + if (!temp) { + return (char*)nullptr; + } + + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(static_cast(temp), 0, &hexSize); + MEOS::Meos::freeTemporalObject(temp); + return hexOut; + }, + trajectoryStr); + + const auto boxStrLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, + boxStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxStrLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { + memcpy(dest, s, len); + free((void*)s); + } + }, + variableSized.getContent(), + boxStr, + boxStrLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TrajectoryWkbAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }, + aggregationState); +} + +size_t TrajectoryWkbAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(Nautilus::Interface::PagedVector); +} + +void TrajectoryWkbAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + { + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTrajectoryWkbAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TRAJECTORY_WKB aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Aggregation/Function/Meos/TspatialExtentAggregationPhysicalFunction.cpp b/nes-physical-operators/src/Aggregation/Function/Meos/TspatialExtentAggregationPhysicalFunction.cpp new file mode 100644 index 0000000000..213faff237 --- /dev/null +++ b/nes-physical-operators/src/Aggregation/Function/Meos/TspatialExtentAggregationPhysicalFunction.cpp @@ -0,0 +1,197 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" { +#include +#include +} + +namespace NES +{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex meos_tspatialextent_mutex; + + +TspatialExtentAggregationPhysicalFunction::TspatialExtentAggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{ +} + +void TspatialExtentAggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{ + // Incremental accumulator slot (no event buffer): each event folds into the + // running extent STBox via tspatial_extent_transfn. O(1) state, like the + // expandable-Temporal* value-output operators. + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tspatialextent_mutex); + STBox** slot = reinterpret_cast(st); + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[96]; + snprintf(wkt, sizeof(wkt), "Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + Temporal* inst = tgeompoint_in(wkt); + if (!inst) { + return; + } + *slot = tspatial_extent_transfn(*slot, inst); + free(inst); + }, + aggregationState, lon, lat, timestamp); +} + +void TspatialExtentAggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* s1, AggregationState* s2) -> void + { + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock(meos_tspatialextent_mutex); + STBox** slot1 = reinterpret_cast(s1); + STBox** slot2 = reinterpret_cast(s2); + if (!*slot2) { + return; + } + if (!*slot1) { + *slot1 = stbox_copy(*slot2); + return; + } + STBox* merged = union_stbox_stbox(*slot1, *slot2, false); + free(*slot1); + *slot1 = merged; + }, + aggregationState1, aggregationState2); +} + +Nautilus::Record TspatialExtentAggregationPhysicalFunction::lower( + const nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) +{ + MEOS::Meos::ensureMeosInitialized(); + auto boxStr = nautilus::invoke( + +[](AggregationState* st) -> char* + { + std::lock_guard lock(meos_tspatialextent_mutex); + STBox** slot = reinterpret_cast(st); + if (!*slot) { + return (char*) nullptr; + } + char* out = stbox_out(*slot, 15); + free(*slot); + *slot = nullptr; + return out; + }, + aggregationState); + + const auto boxLen = nautilus::invoke( + +[](const char* s) -> size_t { return s ? strlen(s) : (size_t) 0; }, boxStr); + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxLen); + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + { + if (s) { memcpy(dest, s, len); free((void*) s); } + }, + variableSized.getContent(), boxStr, boxLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +} + +void TspatialExtentAggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { STBox** slot = reinterpret_cast(st); *slot = nullptr; }, + aggregationState); +} + +size_t TspatialExtentAggregationPhysicalFunction::getSizeOfStateInBytes() const +{ + return sizeof(STBox*); +} + +void TspatialExtentAggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{ + nautilus::invoke( + +[](AggregationState* st) -> void + { STBox** slot = reinterpret_cast(st); if (*slot) { free(*slot); *slot = nullptr; } }, + aggregationState); +} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::RegisterTspatialExtentAggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{ + throw std::runtime_error("TSPATIAL_EXTENT aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +} + +} diff --git a/nes-physical-operators/src/Functions/Meos/AboveStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AboveStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..66e1f9fe6e --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AboveStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AboveStboxStboxPhysicalFunction::AboveStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AboveStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = above_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAboveStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "AboveStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return AboveStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AboveStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AboveStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..e117060e0c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AboveStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AboveStboxTspatialPhysicalFunction::AboveStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AboveStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = above_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAboveStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AboveStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AboveStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AboveTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AboveTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..457bbd7e57 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AboveTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AboveTspatialStboxPhysicalFunction::AboveTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AboveTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = above_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAboveTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AboveTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AboveTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AboveTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AboveTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..de328b82a8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AboveTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AboveTspatialTspatialPhysicalFunction::AboveTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AboveTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return above_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAboveTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "AboveTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return AboveTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AdjacentStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AdjacentStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..90f7ac7df4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AdjacentStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AdjacentStboxStboxPhysicalFunction::AdjacentStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AdjacentStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = adjacent_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAdjacentStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "AdjacentStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return AdjacentStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AdjacentStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AdjacentStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..f9b24f8e90 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AdjacentStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AdjacentStboxTspatialPhysicalFunction::AdjacentStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AdjacentStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = adjacent_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAdjacentStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AdjacentStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AdjacentStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AdjacentTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AdjacentTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..604c68cc06 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AdjacentTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AdjacentTboxTnumberPhysicalFunction::AdjacentTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AdjacentTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = adjacent_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAdjacentTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AdjacentTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AdjacentTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AdjacentTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AdjacentTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..ce4bdde5ba --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AdjacentTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AdjacentTemporalTemporalPhysicalFunction::AdjacentTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AdjacentTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return adjacent_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAdjacentTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "AdjacentTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return AdjacentTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AdjacentTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AdjacentTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..328ad0c933 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AdjacentTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AdjacentTnumberTboxPhysicalFunction::AdjacentTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AdjacentTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = adjacent_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAdjacentTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AdjacentTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AdjacentTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AdjacentTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AdjacentTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..37529e0d45 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AdjacentTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AdjacentTnumberTnumberPhysicalFunction::AdjacentTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AdjacentTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = adjacent_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAdjacentTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "AdjacentTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return AdjacentTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AdjacentTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AdjacentTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..0b20061c17 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AdjacentTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AdjacentTspatialStboxPhysicalFunction::AdjacentTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AdjacentTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = adjacent_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAdjacentTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AdjacentTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AdjacentTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AdjacentTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AdjacentTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..1f08dc12dd --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AdjacentTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AdjacentTspatialTspatialPhysicalFunction::AdjacentTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AdjacentTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return adjacent_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAdjacentTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "AdjacentTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return AdjacentTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AfterStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AfterStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..3aef237588 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AfterStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AfterStboxStboxPhysicalFunction::AfterStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AfterStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = after_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAfterStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "AfterStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return AfterStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AfterStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AfterStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..899b9ce9b1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AfterStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AfterStboxTspatialPhysicalFunction::AfterStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AfterStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = after_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAfterStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AfterStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AfterStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AfterTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AfterTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..24fd6ceda1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AfterTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AfterTboxTnumberPhysicalFunction::AfterTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AfterTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = after_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAfterTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AfterTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AfterTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AfterTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AfterTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..0d89fd8ee1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AfterTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AfterTemporalTemporalPhysicalFunction::AfterTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AfterTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return after_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAfterTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "AfterTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return AfterTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AfterTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AfterTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..7e6b708cf9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AfterTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AfterTnumberTboxPhysicalFunction::AfterTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AfterTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = after_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAfterTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AfterTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AfterTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AfterTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AfterTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..eb958b2523 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AfterTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AfterTnumberTnumberPhysicalFunction::AfterTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AfterTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = after_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAfterTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "AfterTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return AfterTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AfterTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AfterTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..d94777bdc3 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AfterTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AfterTspatialStboxPhysicalFunction::AfterTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AfterTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = after_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAfterTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AfterTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AfterTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AfterTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AfterTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..4a10179df6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AfterTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AfterTspatialTspatialPhysicalFunction::AfterTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AfterTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return after_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAfterTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "AfterTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return AfterTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..ac6c88a49c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysEqFloatTfloatPhysicalFunction::AlwaysEqFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysEqFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_eq_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysEqFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysEqFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..4ef50a55de --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysEqIntTintPhysicalFunction::AlwaysEqIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysEqIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_eq_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysEqIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysEqIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqTboolBoolPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqTboolBoolPhysicalFunction.cpp new file mode 100644 index 0000000000..33726e1951 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqTboolBoolPhysicalFunction.cpp @@ -0,0 +1,98 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysEqTboolBoolPhysicalFunction::AlwaysEqTboolBoolPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AlwaysEqTboolBoolPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](bool value, + uint64_t ts, + bool arg0) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value ? "t" : "f", MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tbool_in(tempWkt.c_str()); + if (!temp) return 0; + + int r = always_eq_tbool_bool(temp, arg0); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, ts, arg0); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqTboolBoolPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysEqTboolBoolPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysEqTboolBoolPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqTcbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqTcbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..2f70df8a94 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqTcbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysEqTcbufferCbufferPhysicalFunction::AlwaysEqTcbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferFunction)); +} + +VarVal AlwaysEqTcbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = always_eq_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqTcbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "AlwaysEqTcbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return AlwaysEqTcbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqTcbufferTcbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqTcbufferTcbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..80b6c638bc --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqTcbufferTcbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysEqTcbufferTcbufferPhysicalFunction::AlwaysEqTcbufferTcbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysEqTcbufferTcbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = always_eq_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqTcbufferTcbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "AlwaysEqTcbufferTcbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return AlwaysEqTcbufferTcbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..83084a0e0a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysEqTemporalTemporalPhysicalFunction::AlwaysEqTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysEqTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = always_eq_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AlwaysEqTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AlwaysEqTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..fa622bc489 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysEqTfloatFloatPhysicalFunction::AlwaysEqTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysEqTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_eq_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysEqTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysEqTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqTgeoGeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqTgeoGeoPhysicalFunction.cpp new file mode 100644 index 0000000000..92d056835a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqTgeoGeoPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysEqTgeoGeoPhysicalFunction::AlwaysEqTgeoGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal AlwaysEqTgeoGeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return always_eq_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqTgeoGeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AlwaysEqTgeoGeoPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AlwaysEqTgeoGeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqTgeoTgeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqTgeoTgeoPhysicalFunction.cpp new file mode 100644 index 0000000000..c5ea551f07 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqTgeoTgeoPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysEqTgeoTgeoPhysicalFunction::AlwaysEqTgeoTgeoPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysEqTgeoTgeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return always_eq_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqTgeoTgeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "AlwaysEqTgeoTgeoPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return AlwaysEqTgeoTgeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysEqTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysEqTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..ebbe163218 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysEqTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysEqTintIntPhysicalFunction::AlwaysEqTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysEqTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_eq_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysEqTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysEqTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysEqTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGeFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGeFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..c21b02d7a2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGeFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGeFloatTfloatPhysicalFunction::AlwaysGeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysGeFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_ge_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGeFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysGeFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysGeFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGeIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGeIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..31522730a6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGeIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGeIntTintPhysicalFunction::AlwaysGeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysGeIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_ge_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGeIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysGeIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysGeIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGeTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGeTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..04c7464b42 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGeTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGeTemporalTemporalPhysicalFunction::AlwaysGeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysGeTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = always_ge_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGeTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AlwaysGeTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AlwaysGeTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGeTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGeTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..fc9d9289e1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGeTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGeTfloatFloatPhysicalFunction::AlwaysGeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysGeTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_ge_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGeTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysGeTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysGeTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGeTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGeTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..c9ce51b677 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGeTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGeTintIntPhysicalFunction::AlwaysGeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysGeTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_ge_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGeTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysGeTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysGeTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGtFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGtFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..00714f9dad --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGtFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGtFloatTfloatPhysicalFunction::AlwaysGtFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysGtFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_gt_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGtFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysGtFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysGtFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGtIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGtIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..ba070cae20 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGtIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGtIntTintPhysicalFunction::AlwaysGtIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysGtIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_gt_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGtIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysGtIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysGtIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGtTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGtTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..8c0f34d56d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGtTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGtTemporalTemporalPhysicalFunction::AlwaysGtTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysGtTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = always_gt_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGtTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AlwaysGtTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AlwaysGtTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGtTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGtTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..a98ab0f453 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGtTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGtTfloatFloatPhysicalFunction::AlwaysGtTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysGtTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_gt_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGtTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysGtTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysGtTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysGtTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysGtTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..a31e5c6fc4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysGtTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysGtTintIntPhysicalFunction::AlwaysGtTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysGtTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_gt_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysGtTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysGtTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysGtTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLeFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLeFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..0183561fa5 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLeFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLeFloatTfloatPhysicalFunction::AlwaysLeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysLeFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_le_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLeFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysLeFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysLeFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLeIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLeIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..c1e20a82f7 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLeIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLeIntTintPhysicalFunction::AlwaysLeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysLeIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_le_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLeIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysLeIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysLeIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLeTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLeTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..a2eca52525 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLeTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLeTemporalTemporalPhysicalFunction::AlwaysLeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysLeTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = always_le_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLeTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AlwaysLeTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AlwaysLeTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLeTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLeTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..8bca88855e --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLeTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLeTfloatFloatPhysicalFunction::AlwaysLeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysLeTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_le_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLeTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysLeTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysLeTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLeTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLeTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..bde032e17d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLeTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLeTintIntPhysicalFunction::AlwaysLeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysLeTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_le_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLeTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysLeTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysLeTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLtFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLtFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..bd0dda0c49 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLtFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLtFloatTfloatPhysicalFunction::AlwaysLtFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysLtFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_lt_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLtFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysLtFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysLtFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLtIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLtIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..a55b25e3f6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLtIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLtIntTintPhysicalFunction::AlwaysLtIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysLtIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_lt_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLtIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysLtIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysLtIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLtTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLtTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..1f15c7f064 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLtTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLtTemporalTemporalPhysicalFunction::AlwaysLtTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysLtTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = always_lt_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLtTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AlwaysLtTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AlwaysLtTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLtTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLtTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..b9ffbf957d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLtTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLtTfloatFloatPhysicalFunction::AlwaysLtTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysLtTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_lt_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLtTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysLtTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysLtTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysLtTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysLtTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..e2c741cbcd --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysLtTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysLtTintIntPhysicalFunction::AlwaysLtTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysLtTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_lt_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysLtTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysLtTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysLtTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..0e80df78c9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysNeFloatTfloatPhysicalFunction::AlwaysNeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysNeFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_ne_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysNeFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysNeFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..1ffddb7a6c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysNeIntTintPhysicalFunction::AlwaysNeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysNeIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_ne_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysNeIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysNeIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeTboolBoolPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeTboolBoolPhysicalFunction.cpp new file mode 100644 index 0000000000..2efad0c521 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeTboolBoolPhysicalFunction.cpp @@ -0,0 +1,98 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysNeTboolBoolPhysicalFunction::AlwaysNeTboolBoolPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal AlwaysNeTboolBoolPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](bool value, + uint64_t ts, + bool arg0) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value ? "t" : "f", MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tbool_in(tempWkt.c_str()); + if (!temp) return 0; + + int r = always_ne_tbool_bool(temp, arg0); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, ts, arg0); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeTboolBoolPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysNeTboolBoolPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysNeTboolBoolPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeTcbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeTcbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..89a394d967 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeTcbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysNeTcbufferCbufferPhysicalFunction::AlwaysNeTcbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferFunction)); +} + +VarVal AlwaysNeTcbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = always_ne_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeTcbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "AlwaysNeTcbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return AlwaysNeTcbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeTcbufferTcbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeTcbufferTcbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..951fede1ba --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeTcbufferTcbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysNeTcbufferTcbufferPhysicalFunction::AlwaysNeTcbufferTcbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysNeTcbufferTcbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = always_ne_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeTcbufferTcbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "AlwaysNeTcbufferTcbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return AlwaysNeTcbufferTcbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..ecc495be1c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysNeTemporalTemporalPhysicalFunction::AlwaysNeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysNeTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = always_ne_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AlwaysNeTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AlwaysNeTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..e366dd89ac --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysNeTfloatFloatPhysicalFunction::AlwaysNeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysNeTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = always_ne_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysNeTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysNeTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeTgeoGeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeTgeoGeoPhysicalFunction.cpp new file mode 100644 index 0000000000..378188b2de --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeTgeoGeoPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysNeTgeoGeoPhysicalFunction::AlwaysNeTgeoGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal AlwaysNeTgeoGeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return always_ne_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeTgeoGeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AlwaysNeTgeoGeoPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AlwaysNeTgeoGeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeTgeoTgeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeTgeoTgeoPhysicalFunction.cpp new file mode 100644 index 0000000000..a219236cf7 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeTgeoTgeoPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AlwaysNeTgeoTgeoPhysicalFunction::AlwaysNeTgeoTgeoPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal AlwaysNeTgeoTgeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return always_ne_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeTgeoTgeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "AlwaysNeTgeoTgeoPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return AlwaysNeTgeoTgeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AlwaysNeTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AlwaysNeTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..5c5a423699 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AlwaysNeTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +AlwaysNeTintIntPhysicalFunction::AlwaysNeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal AlwaysNeTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = always_ne_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAlwaysNeTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "AlwaysNeTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return AlwaysNeTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/AtouchesTpointGeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/AtouchesTpointGeoPhysicalFunction.cpp new file mode 100644 index 0000000000..2b77956035 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/AtouchesTpointGeoPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +AtouchesTpointGeoPhysicalFunction::AtouchesTpointGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal AtouchesTpointGeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return atouches_tpoint_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterAtouchesTpointGeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "AtouchesTpointGeoPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return AtouchesTpointGeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BackStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BackStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..a635e76be6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BackStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BackStboxStboxPhysicalFunction::BackStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BackStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = back_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBackStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "BackStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return BackStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BackStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BackStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..768de836ca --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BackStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BackStboxTspatialPhysicalFunction::BackStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BackStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = back_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBackStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "BackStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return BackStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BackTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BackTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..a50962906b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BackTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BackTspatialStboxPhysicalFunction::BackTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BackTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = back_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBackTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "BackTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return BackTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BackTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BackTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..287e22ca76 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BackTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BackTspatialTspatialPhysicalFunction::BackTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal BackTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return back_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBackTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "BackTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return BackTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BeforeStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BeforeStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..4de674f1a5 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BeforeStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BeforeStboxStboxPhysicalFunction::BeforeStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BeforeStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = before_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBeforeStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "BeforeStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return BeforeStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BeforeStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BeforeStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..3ab334b896 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BeforeStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BeforeStboxTspatialPhysicalFunction::BeforeStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BeforeStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = before_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBeforeStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "BeforeStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return BeforeStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BeforeTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BeforeTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..87bb1e4383 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BeforeTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BeforeTboxTnumberPhysicalFunction::BeforeTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BeforeTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = before_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBeforeTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "BeforeTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return BeforeTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BeforeTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BeforeTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..a08aeea8c5 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BeforeTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BeforeTemporalTemporalPhysicalFunction::BeforeTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal BeforeTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return before_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBeforeTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "BeforeTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return BeforeTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BeforeTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BeforeTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..8368b0a4ec --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BeforeTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BeforeTnumberTboxPhysicalFunction::BeforeTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BeforeTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = before_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBeforeTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "BeforeTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return BeforeTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BeforeTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BeforeTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..fd43e1c4d2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BeforeTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BeforeTnumberTnumberPhysicalFunction::BeforeTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BeforeTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = before_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBeforeTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "BeforeTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return BeforeTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BeforeTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BeforeTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..12f281f0e9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BeforeTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BeforeTspatialStboxPhysicalFunction::BeforeTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BeforeTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = before_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBeforeTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "BeforeTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return BeforeTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BeforeTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BeforeTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..9bc29c9521 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BeforeTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BeforeTspatialTspatialPhysicalFunction::BeforeTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal BeforeTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return before_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBeforeTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "BeforeTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return BeforeTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BelowStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BelowStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..2c4cd8d4fc --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BelowStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BelowStboxStboxPhysicalFunction::BelowStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BelowStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = below_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBelowStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "BelowStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return BelowStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BelowStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BelowStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..093a8747dd --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BelowStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BelowStboxTspatialPhysicalFunction::BelowStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BelowStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = below_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBelowStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "BelowStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return BelowStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BelowTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BelowTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..12072189a5 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BelowTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BelowTspatialStboxPhysicalFunction::BelowTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal BelowTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = below_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBelowTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "BelowTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return BelowTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/BelowTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/BelowTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..e92d3e2535 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/BelowTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +BelowTspatialTspatialPhysicalFunction::BelowTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal BelowTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return below_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterBelowTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "BelowTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return BelowTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/CMakeLists.txt b/nes-physical-operators/src/Functions/Meos/CMakeLists.txt index 516cdce4c3..f57b70d41f 100644 --- a/nes-physical-operators/src/Functions/Meos/CMakeLists.txt +++ b/nes-physical-operators/src/Functions/Meos/CMakeLists.txt @@ -16,3 +16,367 @@ add_plugin(TemporalAIntersectsGeometry PhysicalFunction nes-physical-operators T add_plugin(TemporalEContainsGeometry PhysicalFunction nes-physical-operators TemporalEContainsGeometryPhysicalFunction.cpp) add_plugin(TemporalEDWithinGeometry PhysicalFunction nes-physical-operators TemporalEDWithinGeometryPhysicalFunction.cpp) add_plugin(TemporalAtStBox PhysicalFunction nes-physical-operators TemporalAtStBoxPhysicalFunction.cpp) +add_plugin(TemporalEDisjointGeometry PhysicalFunction nes-physical-operators TemporalEDisjointGeometryPhysicalFunction.cpp) +add_plugin(TemporalATouchesGeometry PhysicalFunction nes-physical-operators TemporalATouchesGeometryPhysicalFunction.cpp) +add_plugin(TemporalECoversGeometry PhysicalFunction nes-physical-operators TemporalECoversGeometryPhysicalFunction.cpp) +add_plugin(TemporalAContainsGeometry PhysicalFunction nes-physical-operators TemporalAContainsGeometryPhysicalFunction.cpp) +add_plugin(TemporalETouchesGeometry PhysicalFunction nes-physical-operators TemporalETouchesGeometryPhysicalFunction.cpp) +add_plugin(TemporalADisjointGeometry PhysicalFunction nes-physical-operators TemporalADisjointGeometryPhysicalFunction.cpp) +add_plugin(TemporalEIntersectsGeometry PhysicalFunction nes-physical-operators TemporalEIntersectsGeometryPhysicalFunction.cpp) +add_plugin(TemporalEContainsTGeometry PhysicalFunction nes-physical-operators TemporalEContainsTGeometryPhysicalFunction.cpp) +add_plugin(TemporalECoversTGeometry PhysicalFunction nes-physical-operators TemporalECoversTGeometryPhysicalFunction.cpp) +add_plugin(TemporalEDisjointTGeometry PhysicalFunction nes-physical-operators TemporalEDisjointTGeometryPhysicalFunction.cpp) +add_plugin(TemporalEIntersectsTGeometry PhysicalFunction nes-physical-operators TemporalEIntersectsTGeometryPhysicalFunction.cpp) +add_plugin(TemporalETouchesTGeometry PhysicalFunction nes-physical-operators TemporalETouchesTGeometryPhysicalFunction.cpp) +add_plugin(TemporalAContainsTGeometry PhysicalFunction nes-physical-operators TemporalAContainsTGeometryPhysicalFunction.cpp) +add_plugin(TemporalADisjointTGeometry PhysicalFunction nes-physical-operators TemporalADisjointTGeometryPhysicalFunction.cpp) +add_plugin(TemporalAIntersectsTGeometry PhysicalFunction nes-physical-operators TemporalAIntersectsTGeometryPhysicalFunction.cpp) +add_plugin(TemporalATouchesTGeometry PhysicalFunction nes-physical-operators TemporalATouchesTGeometryPhysicalFunction.cpp) +add_plugin(TemporalNADGeometry PhysicalFunction nes-physical-operators TemporalNADGeometryPhysicalFunction.cpp) +add_plugin(TemporalNADTGeometry PhysicalFunction nes-physical-operators TemporalNADTGeometryPhysicalFunction.cpp) +add_plugin(TemporalEDWithinTGeometry PhysicalFunction nes-physical-operators TemporalEDWithinTGeometryPhysicalFunction.cpp) +add_plugin(TemporalADWithinGeometry PhysicalFunction nes-physical-operators TemporalADWithinGeometryPhysicalFunction.cpp) +add_plugin(TemporalADWithinTGeometry PhysicalFunction nes-physical-operators TemporalADWithinTGeometryPhysicalFunction.cpp) +add_plugin(TemporalNADFloatScalar PhysicalFunction nes-physical-operators TemporalNADFloatScalarPhysicalFunction.cpp) +add_plugin(TemporalNADIntScalar PhysicalFunction nes-physical-operators TemporalNADIntScalarPhysicalFunction.cpp) +add_plugin(TemporalNADTFloat PhysicalFunction nes-physical-operators TemporalNADTFloatPhysicalFunction.cpp) +add_plugin(TemporalNADTInt PhysicalFunction nes-physical-operators TemporalNADTIntPhysicalFunction.cpp) +add_plugin(TemporalAtGeometry PhysicalFunction nes-physical-operators TemporalAtGeometryPhysicalFunction.cpp) +add_plugin(TemporalMinusGeometry PhysicalFunction nes-physical-operators TemporalMinusGeometryPhysicalFunction.cpp) +add_plugin(TemporalEContainsTCbuffer PhysicalFunction nes-physical-operators TemporalEContainsTCbufferPhysicalFunction.cpp) +add_plugin(TemporalECoversTCbuffer PhysicalFunction nes-physical-operators TemporalECoversTCbufferPhysicalFunction.cpp) +add_plugin(TemporalEDisjointTCbuffer PhysicalFunction nes-physical-operators TemporalEDisjointTCbufferPhysicalFunction.cpp) +add_plugin(TemporalEIntersectsTCbuffer PhysicalFunction nes-physical-operators TemporalEIntersectsTCbufferPhysicalFunction.cpp) +add_plugin(TemporalETouchesTCbuffer PhysicalFunction nes-physical-operators TemporalETouchesTCbufferPhysicalFunction.cpp) +add_plugin(TemporalAContainsTCbuffer PhysicalFunction nes-physical-operators TemporalAContainsTCbufferPhysicalFunction.cpp) +add_plugin(TemporalACoversTCbuffer PhysicalFunction nes-physical-operators TemporalACoversTCbufferPhysicalFunction.cpp) +add_plugin(TemporalADisjointTCbuffer PhysicalFunction nes-physical-operators TemporalADisjointTCbufferPhysicalFunction.cpp) +add_plugin(TemporalAIntersectsTCbuffer PhysicalFunction nes-physical-operators TemporalAIntersectsTCbufferPhysicalFunction.cpp) +add_plugin(TemporalATouchesTCbuffer PhysicalFunction nes-physical-operators TemporalATouchesTCbufferPhysicalFunction.cpp) +add_plugin(TemporalEContainsTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalEContainsTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalECoversTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalECoversTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalEDisjointTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalEDisjointTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalEIntersectsTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalEIntersectsTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalETouchesTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalETouchesTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalAContainsTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalAContainsTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalACoversTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalACoversTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalADisjointTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalADisjointTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalAIntersectsTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalAIntersectsTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalATouchesTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalATouchesTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalADisjointTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalADisjointTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(TemporalAIntersectsTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalAIntersectsTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(TemporalATouchesTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalATouchesTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(TemporalECoversTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalECoversTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(TemporalEIntersectsTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalEIntersectsTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(TemporalETouchesTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalETouchesTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(TemporalEDWithinTCbufferGeometry PhysicalFunction nes-physical-operators TemporalEDWithinTCbufferGeometryPhysicalFunction.cpp) +add_plugin(TemporalADWithinTCbufferGeometry PhysicalFunction nes-physical-operators TemporalADWithinTCbufferGeometryPhysicalFunction.cpp) +add_plugin(TemporalEDWithinTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalEDWithinTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalADWithinTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalADWithinTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalEDWithinTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalEDWithinTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(TemporalADWithinTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalADWithinTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(TemporalEContainsTPoseGeometry PhysicalFunction nes-physical-operators TemporalEContainsTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalECoversTPoseGeometry PhysicalFunction nes-physical-operators TemporalECoversTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalEDisjointTPoseGeometry PhysicalFunction nes-physical-operators TemporalEDisjointTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalEIntersectsTPoseGeometry PhysicalFunction nes-physical-operators TemporalEIntersectsTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalETouchesTPoseGeometry PhysicalFunction nes-physical-operators TemporalETouchesTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalAContainsTPoseGeometry PhysicalFunction nes-physical-operators TemporalAContainsTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalADisjointTPoseGeometry PhysicalFunction nes-physical-operators TemporalADisjointTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalAIntersectsTPoseGeometry PhysicalFunction nes-physical-operators TemporalAIntersectsTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalATouchesTPoseGeometry PhysicalFunction nes-physical-operators TemporalATouchesTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalEContainsTPoseTPose PhysicalFunction nes-physical-operators TemporalEContainsTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalECoversTPoseTPose PhysicalFunction nes-physical-operators TemporalECoversTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalEDisjointTPoseTPose PhysicalFunction nes-physical-operators TemporalEDisjointTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalEIntersectsTPoseTPose PhysicalFunction nes-physical-operators TemporalEIntersectsTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalETouchesTPoseTPose PhysicalFunction nes-physical-operators TemporalETouchesTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalAContainsTPoseTPose PhysicalFunction nes-physical-operators TemporalAContainsTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalADisjointTPoseTPose PhysicalFunction nes-physical-operators TemporalADisjointTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalAIntersectsTPoseTPose PhysicalFunction nes-physical-operators TemporalAIntersectsTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalATouchesTPoseTPose PhysicalFunction nes-physical-operators TemporalATouchesTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalEContainsTNpointGeometry PhysicalFunction nes-physical-operators TemporalEContainsTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalEContainsTNpointTNpoint PhysicalFunction nes-physical-operators TemporalEContainsTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalECoversTNpointGeometry PhysicalFunction nes-physical-operators TemporalECoversTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalECoversTNpointTNpoint PhysicalFunction nes-physical-operators TemporalECoversTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalEDisjointTNpointGeometry PhysicalFunction nes-physical-operators TemporalEDisjointTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalEDisjointTNpointTNpoint PhysicalFunction nes-physical-operators TemporalEDisjointTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalEIntersectsTNpointGeometry PhysicalFunction nes-physical-operators TemporalEIntersectsTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalEIntersectsTNpointTNpoint PhysicalFunction nes-physical-operators TemporalEIntersectsTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalETouchesTNpointGeometry PhysicalFunction nes-physical-operators TemporalETouchesTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalETouchesTNpointTNpoint PhysicalFunction nes-physical-operators TemporalETouchesTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalAContainsTNpointGeometry PhysicalFunction nes-physical-operators TemporalAContainsTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalAContainsTNpointTNpoint PhysicalFunction nes-physical-operators TemporalAContainsTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalADisjointTNpointGeometry PhysicalFunction nes-physical-operators TemporalADisjointTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalADisjointTNpointTNpoint PhysicalFunction nes-physical-operators TemporalADisjointTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalAIntersectsTNpointGeometry PhysicalFunction nes-physical-operators TemporalAIntersectsTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalAIntersectsTNpointTNpoint PhysicalFunction nes-physical-operators TemporalAIntersectsTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalATouchesTNpointGeometry PhysicalFunction nes-physical-operators TemporalATouchesTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalATouchesTNpointTNpoint PhysicalFunction nes-physical-operators TemporalATouchesTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalNADTPoseGeometry PhysicalFunction nes-physical-operators TemporalNADTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalNADTPoseTPose PhysicalFunction nes-physical-operators TemporalNADTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalNADTNpointGeometry PhysicalFunction nes-physical-operators TemporalNADTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalNADTNpointTNpoint PhysicalFunction nes-physical-operators TemporalNADTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalEDWithinTPoseGeometry PhysicalFunction nes-physical-operators TemporalEDWithinTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalEDWithinTPoseTPose PhysicalFunction nes-physical-operators TemporalEDWithinTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalEDWithinTNpointGeometry PhysicalFunction nes-physical-operators TemporalEDWithinTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalEDWithinTNpointTNpoint PhysicalFunction nes-physical-operators TemporalEDWithinTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalADWithinTPoseGeometry PhysicalFunction nes-physical-operators TemporalADWithinTPoseGeometryPhysicalFunction.cpp) +add_plugin(TemporalADWithinTPoseTPose PhysicalFunction nes-physical-operators TemporalADWithinTPoseTPosePhysicalFunction.cpp) +add_plugin(TemporalADWithinTNpointGeometry PhysicalFunction nes-physical-operators TemporalADWithinTNpointGeometryPhysicalFunction.cpp) +add_plugin(TemporalADWithinTNpointTNpoint PhysicalFunction nes-physical-operators TemporalADWithinTNpointTNpointPhysicalFunction.cpp) +add_plugin(TemporalNADTCbuffer PhysicalFunction nes-physical-operators TemporalNADTCbufferPhysicalFunction.cpp) +add_plugin(TemporalNADTCbufferCbuffer PhysicalFunction nes-physical-operators TemporalNADTCbufferCbufferPhysicalFunction.cpp) +add_plugin(TemporalNADTCbufferTCbuffer PhysicalFunction nes-physical-operators TemporalNADTCbufferTCbufferPhysicalFunction.cpp) +add_plugin(AlwaysEqTfloatFloat PhysicalFunction nes-physical-operators AlwaysEqTfloatFloatPhysicalFunction.cpp) +add_plugin(AlwaysEqTintInt PhysicalFunction nes-physical-operators AlwaysEqTintIntPhysicalFunction.cpp) +add_plugin(AlwaysGeTfloatFloat PhysicalFunction nes-physical-operators AlwaysGeTfloatFloatPhysicalFunction.cpp) +add_plugin(AlwaysGeTintInt PhysicalFunction nes-physical-operators AlwaysGeTintIntPhysicalFunction.cpp) +add_plugin(AlwaysGtTfloatFloat PhysicalFunction nes-physical-operators AlwaysGtTfloatFloatPhysicalFunction.cpp) +add_plugin(AlwaysGtTintInt PhysicalFunction nes-physical-operators AlwaysGtTintIntPhysicalFunction.cpp) +add_plugin(AlwaysLeTfloatFloat PhysicalFunction nes-physical-operators AlwaysLeTfloatFloatPhysicalFunction.cpp) +add_plugin(AlwaysLeTintInt PhysicalFunction nes-physical-operators AlwaysLeTintIntPhysicalFunction.cpp) +add_plugin(AlwaysLtTfloatFloat PhysicalFunction nes-physical-operators AlwaysLtTfloatFloatPhysicalFunction.cpp) +add_plugin(AlwaysLtTintInt PhysicalFunction nes-physical-operators AlwaysLtTintIntPhysicalFunction.cpp) +add_plugin(AlwaysNeTfloatFloat PhysicalFunction nes-physical-operators AlwaysNeTfloatFloatPhysicalFunction.cpp) +add_plugin(AlwaysNeTintInt PhysicalFunction nes-physical-operators AlwaysNeTintIntPhysicalFunction.cpp) +add_plugin(EverEqTfloatFloat PhysicalFunction nes-physical-operators EverEqTfloatFloatPhysicalFunction.cpp) +add_plugin(EverEqTintInt PhysicalFunction nes-physical-operators EverEqTintIntPhysicalFunction.cpp) +add_plugin(EverGeTfloatFloat PhysicalFunction nes-physical-operators EverGeTfloatFloatPhysicalFunction.cpp) +add_plugin(EverGeTintInt PhysicalFunction nes-physical-operators EverGeTintIntPhysicalFunction.cpp) +add_plugin(EverGtTfloatFloat PhysicalFunction nes-physical-operators EverGtTfloatFloatPhysicalFunction.cpp) +add_plugin(EverGtTintInt PhysicalFunction nes-physical-operators EverGtTintIntPhysicalFunction.cpp) +add_plugin(EverLeTfloatFloat PhysicalFunction nes-physical-operators EverLeTfloatFloatPhysicalFunction.cpp) +add_plugin(EverLeTintInt PhysicalFunction nes-physical-operators EverLeTintIntPhysicalFunction.cpp) +add_plugin(EverLtTfloatFloat PhysicalFunction nes-physical-operators EverLtTfloatFloatPhysicalFunction.cpp) +add_plugin(EverLtTintInt PhysicalFunction nes-physical-operators EverLtTintIntPhysicalFunction.cpp) +add_plugin(EverNeTfloatFloat PhysicalFunction nes-physical-operators EverNeTfloatFloatPhysicalFunction.cpp) +add_plugin(EverNeTintInt PhysicalFunction nes-physical-operators EverNeTintIntPhysicalFunction.cpp) +add_plugin(AlwaysEqFloatTfloat PhysicalFunction nes-physical-operators AlwaysEqFloatTfloatPhysicalFunction.cpp) +add_plugin(AlwaysEqIntTint PhysicalFunction nes-physical-operators AlwaysEqIntTintPhysicalFunction.cpp) +add_plugin(AlwaysEqTemporalTemporal PhysicalFunction nes-physical-operators AlwaysEqTemporalTemporalPhysicalFunction.cpp) +add_plugin(AlwaysGeFloatTfloat PhysicalFunction nes-physical-operators AlwaysGeFloatTfloatPhysicalFunction.cpp) +add_plugin(AlwaysGeIntTint PhysicalFunction nes-physical-operators AlwaysGeIntTintPhysicalFunction.cpp) +add_plugin(AlwaysGeTemporalTemporal PhysicalFunction nes-physical-operators AlwaysGeTemporalTemporalPhysicalFunction.cpp) +add_plugin(AlwaysGtFloatTfloat PhysicalFunction nes-physical-operators AlwaysGtFloatTfloatPhysicalFunction.cpp) +add_plugin(AlwaysGtIntTint PhysicalFunction nes-physical-operators AlwaysGtIntTintPhysicalFunction.cpp) +add_plugin(AlwaysGtTemporalTemporal PhysicalFunction nes-physical-operators AlwaysGtTemporalTemporalPhysicalFunction.cpp) +add_plugin(AlwaysLeFloatTfloat PhysicalFunction nes-physical-operators AlwaysLeFloatTfloatPhysicalFunction.cpp) +add_plugin(AlwaysLeIntTint PhysicalFunction nes-physical-operators AlwaysLeIntTintPhysicalFunction.cpp) +add_plugin(AlwaysLeTemporalTemporal PhysicalFunction nes-physical-operators AlwaysLeTemporalTemporalPhysicalFunction.cpp) +add_plugin(AlwaysLtFloatTfloat PhysicalFunction nes-physical-operators AlwaysLtFloatTfloatPhysicalFunction.cpp) +add_plugin(AlwaysLtIntTint PhysicalFunction nes-physical-operators AlwaysLtIntTintPhysicalFunction.cpp) +add_plugin(AlwaysLtTemporalTemporal PhysicalFunction nes-physical-operators AlwaysLtTemporalTemporalPhysicalFunction.cpp) +add_plugin(AlwaysNeFloatTfloat PhysicalFunction nes-physical-operators AlwaysNeFloatTfloatPhysicalFunction.cpp) +add_plugin(AlwaysNeIntTint PhysicalFunction nes-physical-operators AlwaysNeIntTintPhysicalFunction.cpp) +add_plugin(AlwaysNeTemporalTemporal PhysicalFunction nes-physical-operators AlwaysNeTemporalTemporalPhysicalFunction.cpp) +add_plugin(EverEqFloatTfloat PhysicalFunction nes-physical-operators EverEqFloatTfloatPhysicalFunction.cpp) +add_plugin(EverEqIntTint PhysicalFunction nes-physical-operators EverEqIntTintPhysicalFunction.cpp) +add_plugin(EverEqTemporalTemporal PhysicalFunction nes-physical-operators EverEqTemporalTemporalPhysicalFunction.cpp) +add_plugin(EverGeFloatTfloat PhysicalFunction nes-physical-operators EverGeFloatTfloatPhysicalFunction.cpp) +add_plugin(EverGeIntTint PhysicalFunction nes-physical-operators EverGeIntTintPhysicalFunction.cpp) +add_plugin(EverGeTemporalTemporal PhysicalFunction nes-physical-operators EverGeTemporalTemporalPhysicalFunction.cpp) +add_plugin(EverGtFloatTfloat PhysicalFunction nes-physical-operators EverGtFloatTfloatPhysicalFunction.cpp) +add_plugin(EverGtIntTint PhysicalFunction nes-physical-operators EverGtIntTintPhysicalFunction.cpp) +add_plugin(EverGtTemporalTemporal PhysicalFunction nes-physical-operators EverGtTemporalTemporalPhysicalFunction.cpp) +add_plugin(EverLeFloatTfloat PhysicalFunction nes-physical-operators EverLeFloatTfloatPhysicalFunction.cpp) +add_plugin(EverLeIntTint PhysicalFunction nes-physical-operators EverLeIntTintPhysicalFunction.cpp) +add_plugin(EverLeTemporalTemporal PhysicalFunction nes-physical-operators EverLeTemporalTemporalPhysicalFunction.cpp) +add_plugin(EverLtFloatTfloat PhysicalFunction nes-physical-operators EverLtFloatTfloatPhysicalFunction.cpp) +add_plugin(EverLtIntTint PhysicalFunction nes-physical-operators EverLtIntTintPhysicalFunction.cpp) +add_plugin(EverLtTemporalTemporal PhysicalFunction nes-physical-operators EverLtTemporalTemporalPhysicalFunction.cpp) +add_plugin(EverNeFloatTfloat PhysicalFunction nes-physical-operators EverNeFloatTfloatPhysicalFunction.cpp) +add_plugin(EverNeIntTint PhysicalFunction nes-physical-operators EverNeIntTintPhysicalFunction.cpp) +add_plugin(EverNeTemporalTemporal PhysicalFunction nes-physical-operators EverNeTemporalTemporalPhysicalFunction.cpp) +add_plugin(AlwaysEqTcbufferCbuffer PhysicalFunction nes-physical-operators AlwaysEqTcbufferCbufferPhysicalFunction.cpp) +add_plugin(AlwaysEqTcbufferTcbuffer PhysicalFunction nes-physical-operators AlwaysEqTcbufferTcbufferPhysicalFunction.cpp) +add_plugin(AlwaysEqTgeoGeo PhysicalFunction nes-physical-operators AlwaysEqTgeoGeoPhysicalFunction.cpp) +add_plugin(AlwaysEqTgeoTgeo PhysicalFunction nes-physical-operators AlwaysEqTgeoTgeoPhysicalFunction.cpp) +add_plugin(AlwaysNeTcbufferCbuffer PhysicalFunction nes-physical-operators AlwaysNeTcbufferCbufferPhysicalFunction.cpp) +add_plugin(AlwaysNeTcbufferTcbuffer PhysicalFunction nes-physical-operators AlwaysNeTcbufferTcbufferPhysicalFunction.cpp) +add_plugin(AlwaysNeTgeoGeo PhysicalFunction nes-physical-operators AlwaysNeTgeoGeoPhysicalFunction.cpp) +add_plugin(AlwaysNeTgeoTgeo PhysicalFunction nes-physical-operators AlwaysNeTgeoTgeoPhysicalFunction.cpp) +add_plugin(AtouchesTpointGeo PhysicalFunction nes-physical-operators AtouchesTpointGeoPhysicalFunction.cpp) +add_plugin(EtouchesTpointGeo PhysicalFunction nes-physical-operators EtouchesTpointGeoPhysicalFunction.cpp) +add_plugin(EverEqTcbufferCbuffer PhysicalFunction nes-physical-operators EverEqTcbufferCbufferPhysicalFunction.cpp) +add_plugin(EverEqTcbufferTcbuffer PhysicalFunction nes-physical-operators EverEqTcbufferTcbufferPhysicalFunction.cpp) +add_plugin(EverEqTgeoGeo PhysicalFunction nes-physical-operators EverEqTgeoGeoPhysicalFunction.cpp) +add_plugin(EverEqTgeoTgeo PhysicalFunction nes-physical-operators EverEqTgeoTgeoPhysicalFunction.cpp) +add_plugin(EverNeTcbufferCbuffer PhysicalFunction nes-physical-operators EverNeTcbufferCbufferPhysicalFunction.cpp) +add_plugin(EverNeTcbufferTcbuffer PhysicalFunction nes-physical-operators EverNeTcbufferTcbufferPhysicalFunction.cpp) +add_plugin(EverNeTgeoGeo PhysicalFunction nes-physical-operators EverNeTgeoGeoPhysicalFunction.cpp) +add_plugin(EverNeTgeoTgeo PhysicalFunction nes-physical-operators EverNeTgeoTgeoPhysicalFunction.cpp) +add_plugin(TboolEndValue PhysicalFunction nes-physical-operators TboolEndValuePhysicalFunction.cpp) +add_plugin(TboolStartValue PhysicalFunction nes-physical-operators TboolStartValuePhysicalFunction.cpp) +add_plugin(TnpointLength PhysicalFunction nes-physical-operators TnpointLengthPhysicalFunction.cpp) +add_plugin(AboveTspatialTspatial PhysicalFunction nes-physical-operators AboveTspatialTspatialPhysicalFunction.cpp) +add_plugin(AdjacentTemporalTemporal PhysicalFunction nes-physical-operators AdjacentTemporalTemporalPhysicalFunction.cpp) +add_plugin(AdjacentTspatialTspatial PhysicalFunction nes-physical-operators AdjacentTspatialTspatialPhysicalFunction.cpp) +add_plugin(AfterTemporalTemporal PhysicalFunction nes-physical-operators AfterTemporalTemporalPhysicalFunction.cpp) +add_plugin(AfterTspatialTspatial PhysicalFunction nes-physical-operators AfterTspatialTspatialPhysicalFunction.cpp) +add_plugin(AlwaysEqTboolBool PhysicalFunction nes-physical-operators AlwaysEqTboolBoolPhysicalFunction.cpp) +add_plugin(AlwaysNeTboolBool PhysicalFunction nes-physical-operators AlwaysNeTboolBoolPhysicalFunction.cpp) +add_plugin(BackTspatialTspatial PhysicalFunction nes-physical-operators BackTspatialTspatialPhysicalFunction.cpp) +add_plugin(BeforeTemporalTemporal PhysicalFunction nes-physical-operators BeforeTemporalTemporalPhysicalFunction.cpp) +add_plugin(BeforeTspatialTspatial PhysicalFunction nes-physical-operators BeforeTspatialTspatialPhysicalFunction.cpp) +add_plugin(BelowTspatialTspatial PhysicalFunction nes-physical-operators BelowTspatialTspatialPhysicalFunction.cpp) +add_plugin(ContainedTemporalTemporal PhysicalFunction nes-physical-operators ContainedTemporalTemporalPhysicalFunction.cpp) +add_plugin(ContainedTspatialTspatial PhysicalFunction nes-physical-operators ContainedTspatialTspatialPhysicalFunction.cpp) +add_plugin(ContainsTemporalTemporal PhysicalFunction nes-physical-operators ContainsTemporalTemporalPhysicalFunction.cpp) +add_plugin(ContainsTspatialTspatial PhysicalFunction nes-physical-operators ContainsTspatialTspatialPhysicalFunction.cpp) +add_plugin(EverEqTboolBool PhysicalFunction nes-physical-operators EverEqTboolBoolPhysicalFunction.cpp) +add_plugin(EverNeTboolBool PhysicalFunction nes-physical-operators EverNeTboolBoolPhysicalFunction.cpp) +add_plugin(FrontTspatialTspatial PhysicalFunction nes-physical-operators FrontTspatialTspatialPhysicalFunction.cpp) +add_plugin(LeftTspatialTspatial PhysicalFunction nes-physical-operators LeftTspatialTspatialPhysicalFunction.cpp) +add_plugin(NadTnpointGeo PhysicalFunction nes-physical-operators NadTnpointGeoPhysicalFunction.cpp) +add_plugin(NadTposeGeo PhysicalFunction nes-physical-operators NadTposeGeoPhysicalFunction.cpp) +add_plugin(OveraboveTspatialTspatial PhysicalFunction nes-physical-operators OveraboveTspatialTspatialPhysicalFunction.cpp) +add_plugin(OverafterTemporalTemporal PhysicalFunction nes-physical-operators OverafterTemporalTemporalPhysicalFunction.cpp) +add_plugin(OverafterTspatialTspatial PhysicalFunction nes-physical-operators OverafterTspatialTspatialPhysicalFunction.cpp) +add_plugin(OverbackTspatialTspatial PhysicalFunction nes-physical-operators OverbackTspatialTspatialPhysicalFunction.cpp) +add_plugin(OverbeforeTemporalTemporal PhysicalFunction nes-physical-operators OverbeforeTemporalTemporalPhysicalFunction.cpp) +add_plugin(OverbeforeTspatialTspatial PhysicalFunction nes-physical-operators OverbeforeTspatialTspatialPhysicalFunction.cpp) +add_plugin(OverbelowTspatialTspatial PhysicalFunction nes-physical-operators OverbelowTspatialTspatialPhysicalFunction.cpp) +add_plugin(OverfrontTspatialTspatial PhysicalFunction nes-physical-operators OverfrontTspatialTspatialPhysicalFunction.cpp) +add_plugin(OverlapsTemporalTemporal PhysicalFunction nes-physical-operators OverlapsTemporalTemporalPhysicalFunction.cpp) +add_plugin(OverlapsTspatialTspatial PhysicalFunction nes-physical-operators OverlapsTspatialTspatialPhysicalFunction.cpp) +add_plugin(OverleftTspatialTspatial PhysicalFunction nes-physical-operators OverleftTspatialTspatialPhysicalFunction.cpp) +add_plugin(OverrightTspatialTspatial PhysicalFunction nes-physical-operators OverrightTspatialTspatialPhysicalFunction.cpp) +add_plugin(RightTspatialTspatial PhysicalFunction nes-physical-operators RightTspatialTspatialPhysicalFunction.cpp) +add_plugin(SameTemporalTemporal PhysicalFunction nes-physical-operators SameTemporalTemporalPhysicalFunction.cpp) +add_plugin(SameTspatialTspatial PhysicalFunction nes-physical-operators SameTspatialTspatialPhysicalFunction.cpp) +add_plugin(TemporalCmp PhysicalFunction nes-physical-operators TemporalCmpPhysicalFunction.cpp) +add_plugin(TemporalDyntimewarpDistance PhysicalFunction nes-physical-operators TemporalDyntimewarpDistancePhysicalFunction.cpp) +add_plugin(TemporalEq PhysicalFunction nes-physical-operators TemporalEqPhysicalFunction.cpp) +add_plugin(TemporalFrechetDistance PhysicalFunction nes-physical-operators TemporalFrechetDistancePhysicalFunction.cpp) +add_plugin(TemporalGe PhysicalFunction nes-physical-operators TemporalGePhysicalFunction.cpp) +add_plugin(TemporalGt PhysicalFunction nes-physical-operators TemporalGtPhysicalFunction.cpp) +add_plugin(TemporalHausdorffDistance PhysicalFunction nes-physical-operators TemporalHausdorffDistancePhysicalFunction.cpp) +add_plugin(TemporalLe PhysicalFunction nes-physical-operators TemporalLePhysicalFunction.cpp) +add_plugin(TemporalLt PhysicalFunction nes-physical-operators TemporalLtPhysicalFunction.cpp) +add_plugin(TemporalNe PhysicalFunction nes-physical-operators TemporalNePhysicalFunction.cpp) +add_plugin(TboolToTint PhysicalFunction nes-physical-operators TboolToTintPhysicalFunction.cpp) +add_plugin(TcbufferToTfloat PhysicalFunction nes-physical-operators TcbufferToTfloatPhysicalFunction.cpp) +add_plugin(TfloatCeil PhysicalFunction nes-physical-operators TfloatCeilPhysicalFunction.cpp) +add_plugin(TfloatExp PhysicalFunction nes-physical-operators TfloatExpPhysicalFunction.cpp) +add_plugin(TfloatFloor PhysicalFunction nes-physical-operators TfloatFloorPhysicalFunction.cpp) +add_plugin(TfloatLn PhysicalFunction nes-physical-operators TfloatLnPhysicalFunction.cpp) +add_plugin(TfloatLog10 PhysicalFunction nes-physical-operators TfloatLog10PhysicalFunction.cpp) +add_plugin(TfloatRadians PhysicalFunction nes-physical-operators TfloatRadiansPhysicalFunction.cpp) +add_plugin(TfloatToTint PhysicalFunction nes-physical-operators TfloatToTintPhysicalFunction.cpp) +add_plugin(TintToTfloat PhysicalFunction nes-physical-operators TintToTfloatPhysicalFunction.cpp) +add_plugin(AdjacentTnumberTbox PhysicalFunction nes-physical-operators AdjacentTnumberTboxPhysicalFunction.cpp) +add_plugin(AfterTnumberTbox PhysicalFunction nes-physical-operators AfterTnumberTboxPhysicalFunction.cpp) +add_plugin(BeforeTnumberTbox PhysicalFunction nes-physical-operators BeforeTnumberTboxPhysicalFunction.cpp) +add_plugin(ContainedTnumberTbox PhysicalFunction nes-physical-operators ContainedTnumberTboxPhysicalFunction.cpp) +add_plugin(ContainsTnumberTbox PhysicalFunction nes-physical-operators ContainsTnumberTboxPhysicalFunction.cpp) +add_plugin(LeftTnumberTbox PhysicalFunction nes-physical-operators LeftTnumberTboxPhysicalFunction.cpp) +add_plugin(NadTcbufferStbox PhysicalFunction nes-physical-operators NadTcbufferStboxPhysicalFunction.cpp) +add_plugin(NadTfloatTbox PhysicalFunction nes-physical-operators NadTfloatTboxPhysicalFunction.cpp) +add_plugin(NadTgeoStbox PhysicalFunction nes-physical-operators NadTgeoStboxPhysicalFunction.cpp) +add_plugin(NadTintTbox PhysicalFunction nes-physical-operators NadTintTboxPhysicalFunction.cpp) +add_plugin(NadTnpointStbox PhysicalFunction nes-physical-operators NadTnpointStboxPhysicalFunction.cpp) +add_plugin(NadTposeStbox PhysicalFunction nes-physical-operators NadTposeStboxPhysicalFunction.cpp) +add_plugin(OverafterTnumberTbox PhysicalFunction nes-physical-operators OverafterTnumberTboxPhysicalFunction.cpp) +add_plugin(OverbeforeTnumberTbox PhysicalFunction nes-physical-operators OverbeforeTnumberTboxPhysicalFunction.cpp) +add_plugin(OverlapsTnumberTbox PhysicalFunction nes-physical-operators OverlapsTnumberTboxPhysicalFunction.cpp) +add_plugin(OverleftTnumberTbox PhysicalFunction nes-physical-operators OverleftTnumberTboxPhysicalFunction.cpp) +add_plugin(OverrightTnumberTbox PhysicalFunction nes-physical-operators OverrightTnumberTboxPhysicalFunction.cpp) +add_plugin(RightTnumberTbox PhysicalFunction nes-physical-operators RightTnumberTboxPhysicalFunction.cpp) +add_plugin(SameTnumberTbox PhysicalFunction nes-physical-operators SameTnumberTboxPhysicalFunction.cpp) +add_plugin(AboveStboxTspatial PhysicalFunction nes-physical-operators AboveStboxTspatialPhysicalFunction.cpp) +add_plugin(AboveTspatialStbox PhysicalFunction nes-physical-operators AboveTspatialStboxPhysicalFunction.cpp) +add_plugin(AdjacentStboxTspatial PhysicalFunction nes-physical-operators AdjacentStboxTspatialPhysicalFunction.cpp) +add_plugin(AdjacentTboxTnumber PhysicalFunction nes-physical-operators AdjacentTboxTnumberPhysicalFunction.cpp) +add_plugin(AdjacentTspatialStbox PhysicalFunction nes-physical-operators AdjacentTspatialStboxPhysicalFunction.cpp) +add_plugin(AfterStboxTspatial PhysicalFunction nes-physical-operators AfterStboxTspatialPhysicalFunction.cpp) +add_plugin(AfterTboxTnumber PhysicalFunction nes-physical-operators AfterTboxTnumberPhysicalFunction.cpp) +add_plugin(AfterTspatialStbox PhysicalFunction nes-physical-operators AfterTspatialStboxPhysicalFunction.cpp) +add_plugin(BackStboxTspatial PhysicalFunction nes-physical-operators BackStboxTspatialPhysicalFunction.cpp) +add_plugin(BackTspatialStbox PhysicalFunction nes-physical-operators BackTspatialStboxPhysicalFunction.cpp) +add_plugin(BeforeStboxTspatial PhysicalFunction nes-physical-operators BeforeStboxTspatialPhysicalFunction.cpp) +add_plugin(BeforeTboxTnumber PhysicalFunction nes-physical-operators BeforeTboxTnumberPhysicalFunction.cpp) +add_plugin(BeforeTspatialStbox PhysicalFunction nes-physical-operators BeforeTspatialStboxPhysicalFunction.cpp) +add_plugin(BelowStboxTspatial PhysicalFunction nes-physical-operators BelowStboxTspatialPhysicalFunction.cpp) +add_plugin(BelowTspatialStbox PhysicalFunction nes-physical-operators BelowTspatialStboxPhysicalFunction.cpp) +add_plugin(ContainedStboxTspatial PhysicalFunction nes-physical-operators ContainedStboxTspatialPhysicalFunction.cpp) +add_plugin(ContainedTboxTnumber PhysicalFunction nes-physical-operators ContainedTboxTnumberPhysicalFunction.cpp) +add_plugin(ContainedTspatialStbox PhysicalFunction nes-physical-operators ContainedTspatialStboxPhysicalFunction.cpp) +add_plugin(ContainsStboxTspatial PhysicalFunction nes-physical-operators ContainsStboxTspatialPhysicalFunction.cpp) +add_plugin(ContainsTboxTnumber PhysicalFunction nes-physical-operators ContainsTboxTnumberPhysicalFunction.cpp) +add_plugin(ContainsTspatialStbox PhysicalFunction nes-physical-operators ContainsTspatialStboxPhysicalFunction.cpp) +add_plugin(FrontStboxTspatial PhysicalFunction nes-physical-operators FrontStboxTspatialPhysicalFunction.cpp) +add_plugin(FrontTspatialStbox PhysicalFunction nes-physical-operators FrontTspatialStboxPhysicalFunction.cpp) +add_plugin(LeftStboxTspatial PhysicalFunction nes-physical-operators LeftStboxTspatialPhysicalFunction.cpp) +add_plugin(LeftTboxTnumber PhysicalFunction nes-physical-operators LeftTboxTnumberPhysicalFunction.cpp) +add_plugin(LeftTspatialStbox PhysicalFunction nes-physical-operators LeftTspatialStboxPhysicalFunction.cpp) +add_plugin(OveraboveStboxTspatial PhysicalFunction nes-physical-operators OveraboveStboxTspatialPhysicalFunction.cpp) +add_plugin(OveraboveTspatialStbox PhysicalFunction nes-physical-operators OveraboveTspatialStboxPhysicalFunction.cpp) +add_plugin(OverafterStboxTspatial PhysicalFunction nes-physical-operators OverafterStboxTspatialPhysicalFunction.cpp) +add_plugin(OverafterTboxTnumber PhysicalFunction nes-physical-operators OverafterTboxTnumberPhysicalFunction.cpp) +add_plugin(OverafterTspatialStbox PhysicalFunction nes-physical-operators OverafterTspatialStboxPhysicalFunction.cpp) +add_plugin(OverbackStboxTspatial PhysicalFunction nes-physical-operators OverbackStboxTspatialPhysicalFunction.cpp) +add_plugin(OverbackTspatialStbox PhysicalFunction nes-physical-operators OverbackTspatialStboxPhysicalFunction.cpp) +add_plugin(OverbeforeStboxTspatial PhysicalFunction nes-physical-operators OverbeforeStboxTspatialPhysicalFunction.cpp) +add_plugin(OverbeforeTboxTnumber PhysicalFunction nes-physical-operators OverbeforeTboxTnumberPhysicalFunction.cpp) +add_plugin(OverbeforeTspatialStbox PhysicalFunction nes-physical-operators OverbeforeTspatialStboxPhysicalFunction.cpp) +add_plugin(OverbelowStboxTspatial PhysicalFunction nes-physical-operators OverbelowStboxTspatialPhysicalFunction.cpp) +add_plugin(OverbelowTspatialStbox PhysicalFunction nes-physical-operators OverbelowTspatialStboxPhysicalFunction.cpp) +add_plugin(OverfrontStboxTspatial PhysicalFunction nes-physical-operators OverfrontStboxTspatialPhysicalFunction.cpp) +add_plugin(OverfrontTspatialStbox PhysicalFunction nes-physical-operators OverfrontTspatialStboxPhysicalFunction.cpp) +add_plugin(OverlapsStboxTspatial PhysicalFunction nes-physical-operators OverlapsStboxTspatialPhysicalFunction.cpp) +add_plugin(OverlapsTboxTnumber PhysicalFunction nes-physical-operators OverlapsTboxTnumberPhysicalFunction.cpp) +add_plugin(OverlapsTspatialStbox PhysicalFunction nes-physical-operators OverlapsTspatialStboxPhysicalFunction.cpp) +add_plugin(OverleftStboxTspatial PhysicalFunction nes-physical-operators OverleftStboxTspatialPhysicalFunction.cpp) +add_plugin(OverleftTboxTnumber PhysicalFunction nes-physical-operators OverleftTboxTnumberPhysicalFunction.cpp) +add_plugin(OverleftTspatialStbox PhysicalFunction nes-physical-operators OverleftTspatialStboxPhysicalFunction.cpp) +add_plugin(OverrightStboxTspatial PhysicalFunction nes-physical-operators OverrightStboxTspatialPhysicalFunction.cpp) +add_plugin(OverrightTboxTnumber PhysicalFunction nes-physical-operators OverrightTboxTnumberPhysicalFunction.cpp) +add_plugin(OverrightTspatialStbox PhysicalFunction nes-physical-operators OverrightTspatialStboxPhysicalFunction.cpp) +add_plugin(RightStboxTspatial PhysicalFunction nes-physical-operators RightStboxTspatialPhysicalFunction.cpp) +add_plugin(RightTboxTnumber PhysicalFunction nes-physical-operators RightTboxTnumberPhysicalFunction.cpp) +add_plugin(RightTspatialStbox PhysicalFunction nes-physical-operators RightTspatialStboxPhysicalFunction.cpp) +add_plugin(SameStboxTspatial PhysicalFunction nes-physical-operators SameStboxTspatialPhysicalFunction.cpp) +add_plugin(SameTboxTnumber PhysicalFunction nes-physical-operators SameTboxTnumberPhysicalFunction.cpp) +add_plugin(SameTspatialStbox PhysicalFunction nes-physical-operators SameTspatialStboxPhysicalFunction.cpp) +add_plugin(TpointLengthWkb PhysicalFunction nes-physical-operators TpointLengthWkbPhysicalFunction.cpp) +add_plugin(AboveStboxStbox PhysicalFunction nes-physical-operators AboveStboxStboxPhysicalFunction.cpp) +add_plugin(AdjacentStboxStbox PhysicalFunction nes-physical-operators AdjacentStboxStboxPhysicalFunction.cpp) +add_plugin(AfterStboxStbox PhysicalFunction nes-physical-operators AfterStboxStboxPhysicalFunction.cpp) +add_plugin(BackStboxStbox PhysicalFunction nes-physical-operators BackStboxStboxPhysicalFunction.cpp) +add_plugin(BeforeStboxStbox PhysicalFunction nes-physical-operators BeforeStboxStboxPhysicalFunction.cpp) +add_plugin(BelowStboxStbox PhysicalFunction nes-physical-operators BelowStboxStboxPhysicalFunction.cpp) +add_plugin(ContainedStboxStbox PhysicalFunction nes-physical-operators ContainedStboxStboxPhysicalFunction.cpp) +add_plugin(ContainsStboxStbox PhysicalFunction nes-physical-operators ContainsStboxStboxPhysicalFunction.cpp) +add_plugin(FrontStboxStbox PhysicalFunction nes-physical-operators FrontStboxStboxPhysicalFunction.cpp) +add_plugin(LeftStboxStbox PhysicalFunction nes-physical-operators LeftStboxStboxPhysicalFunction.cpp) +add_plugin(NadStboxStbox PhysicalFunction nes-physical-operators NadStboxStboxPhysicalFunction.cpp) +add_plugin(OveraboveStboxStbox PhysicalFunction nes-physical-operators OveraboveStboxStboxPhysicalFunction.cpp) +add_plugin(OverafterStboxStbox PhysicalFunction nes-physical-operators OverafterStboxStboxPhysicalFunction.cpp) +add_plugin(OverbackStboxStbox PhysicalFunction nes-physical-operators OverbackStboxStboxPhysicalFunction.cpp) +add_plugin(OverbeforeStboxStbox PhysicalFunction nes-physical-operators OverbeforeStboxStboxPhysicalFunction.cpp) +add_plugin(OverbelowStboxStbox PhysicalFunction nes-physical-operators OverbelowStboxStboxPhysicalFunction.cpp) +add_plugin(OverfrontStboxStbox PhysicalFunction nes-physical-operators OverfrontStboxStboxPhysicalFunction.cpp) +add_plugin(OverlapsStboxStbox PhysicalFunction nes-physical-operators OverlapsStboxStboxPhysicalFunction.cpp) +add_plugin(OverleftStboxStbox PhysicalFunction nes-physical-operators OverleftStboxStboxPhysicalFunction.cpp) +add_plugin(OverrightStboxStbox PhysicalFunction nes-physical-operators OverrightStboxStboxPhysicalFunction.cpp) +add_plugin(RightStboxStbox PhysicalFunction nes-physical-operators RightStboxStboxPhysicalFunction.cpp) +add_plugin(SameStboxStbox PhysicalFunction nes-physical-operators SameStboxStboxPhysicalFunction.cpp) +add_plugin(StboxCmp PhysicalFunction nes-physical-operators StboxCmpPhysicalFunction.cpp) +add_plugin(StboxEq PhysicalFunction nes-physical-operators StboxEqPhysicalFunction.cpp) +add_plugin(StboxGe PhysicalFunction nes-physical-operators StboxGePhysicalFunction.cpp) +add_plugin(StboxGt PhysicalFunction nes-physical-operators StboxGtPhysicalFunction.cpp) +add_plugin(StboxLe PhysicalFunction nes-physical-operators StboxLePhysicalFunction.cpp) +add_plugin(StboxLt PhysicalFunction nes-physical-operators StboxLtPhysicalFunction.cpp) +add_plugin(StboxNe PhysicalFunction nes-physical-operators StboxNePhysicalFunction.cpp) +add_plugin(AdjacentTnumberTnumber PhysicalFunction nes-physical-operators AdjacentTnumberTnumberPhysicalFunction.cpp) +add_plugin(AfterTnumberTnumber PhysicalFunction nes-physical-operators AfterTnumberTnumberPhysicalFunction.cpp) +add_plugin(BeforeTnumberTnumber PhysicalFunction nes-physical-operators BeforeTnumberTnumberPhysicalFunction.cpp) +add_plugin(ContainedTnumberTnumber PhysicalFunction nes-physical-operators ContainedTnumberTnumberPhysicalFunction.cpp) +add_plugin(ContainsTnumberTnumber PhysicalFunction nes-physical-operators ContainsTnumberTnumberPhysicalFunction.cpp) +add_plugin(LeftTnumberTnumber PhysicalFunction nes-physical-operators LeftTnumberTnumberPhysicalFunction.cpp) +add_plugin(OverafterTnumberTnumber PhysicalFunction nes-physical-operators OverafterTnumberTnumberPhysicalFunction.cpp) +add_plugin(OverbeforeTnumberTnumber PhysicalFunction nes-physical-operators OverbeforeTnumberTnumberPhysicalFunction.cpp) +add_plugin(OverlapsTnumberTnumber PhysicalFunction nes-physical-operators OverlapsTnumberTnumberPhysicalFunction.cpp) +add_plugin(OverleftTnumberTnumber PhysicalFunction nes-physical-operators OverleftTnumberTnumberPhysicalFunction.cpp) +add_plugin(OverrightTnumberTnumber PhysicalFunction nes-physical-operators OverrightTnumberTnumberPhysicalFunction.cpp) +add_plugin(RightTnumberTnumber PhysicalFunction nes-physical-operators RightTnumberTnumberPhysicalFunction.cpp) +add_plugin(SameTnumberTnumber PhysicalFunction nes-physical-operators SameTnumberTnumberPhysicalFunction.cpp) diff --git a/nes-physical-operators/src/Functions/Meos/ContainedStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainedStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..1b33ff56c8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainedStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainedStboxStboxPhysicalFunction::ContainedStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainedStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contained_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainedStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "ContainedStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return ContainedStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainedStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainedStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..7d1049811b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainedStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainedStboxTspatialPhysicalFunction::ContainedStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainedStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contained_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainedStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "ContainedStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return ContainedStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainedTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainedTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..1c0fb55c6f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainedTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainedTboxTnumberPhysicalFunction::ContainedTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainedTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contained_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainedTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "ContainedTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return ContainedTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainedTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainedTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..95da59df86 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainedTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainedTemporalTemporalPhysicalFunction::ContainedTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal ContainedTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return contained_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainedTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "ContainedTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return ContainedTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainedTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainedTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..68eb12aed2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainedTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainedTnumberTboxPhysicalFunction::ContainedTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainedTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contained_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainedTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "ContainedTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return ContainedTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainedTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainedTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..f51f4cc777 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainedTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainedTnumberTnumberPhysicalFunction::ContainedTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainedTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = contained_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainedTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "ContainedTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return ContainedTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainedTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainedTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..b97e524cca --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainedTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainedTspatialStboxPhysicalFunction::ContainedTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainedTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contained_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainedTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "ContainedTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return ContainedTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainedTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainedTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..a42f8de814 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainedTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainedTspatialTspatialPhysicalFunction::ContainedTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal ContainedTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return contained_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainedTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "ContainedTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return ContainedTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainsStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainsStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..6038c07f47 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainsStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainsStboxStboxPhysicalFunction::ContainsStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainsStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contains_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainsStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "ContainsStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return ContainsStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainsStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainsStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..dbcd7f0353 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainsStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainsStboxTspatialPhysicalFunction::ContainsStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainsStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contains_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainsStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "ContainsStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return ContainsStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainsTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainsTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..2fd2986e22 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainsTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainsTboxTnumberPhysicalFunction::ContainsTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainsTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contains_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainsTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "ContainsTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return ContainsTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainsTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainsTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..88a9cbfe84 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainsTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainsTemporalTemporalPhysicalFunction::ContainsTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal ContainsTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return contains_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainsTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "ContainsTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return ContainsTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainsTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainsTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..d930d8d0d4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainsTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainsTnumberTboxPhysicalFunction::ContainsTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainsTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contains_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainsTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "ContainsTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return ContainsTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainsTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainsTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..22e8890517 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainsTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainsTnumberTnumberPhysicalFunction::ContainsTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainsTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = contains_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainsTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "ContainsTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return ContainsTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainsTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainsTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..32e7bc0b83 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainsTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainsTspatialStboxPhysicalFunction::ContainsTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal ContainsTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = contains_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainsTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "ContainsTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return ContainsTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/ContainsTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/ContainsTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..7530bac255 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/ContainsTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +ContainsTspatialTspatialPhysicalFunction::ContainsTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal ContainsTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return contains_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterContainsTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "ContainsTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return ContainsTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EtouchesTpointGeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EtouchesTpointGeoPhysicalFunction.cpp new file mode 100644 index 0000000000..6cf77f2ec9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EtouchesTpointGeoPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EtouchesTpointGeoPhysicalFunction::EtouchesTpointGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal EtouchesTpointGeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return etouches_tpoint_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEtouchesTpointGeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EtouchesTpointGeoPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EtouchesTpointGeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..24e028b22a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverEqFloatTfloatPhysicalFunction::EverEqFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverEqFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_eq_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverEqFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverEqFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..2826de5b95 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverEqIntTintPhysicalFunction::EverEqIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverEqIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_eq_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverEqIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverEqIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqTboolBoolPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqTboolBoolPhysicalFunction.cpp new file mode 100644 index 0000000000..cde91b12cf --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqTboolBoolPhysicalFunction.cpp @@ -0,0 +1,98 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverEqTboolBoolPhysicalFunction::EverEqTboolBoolPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal EverEqTboolBoolPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](bool value, + uint64_t ts, + bool arg0) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value ? "t" : "f", MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tbool_in(tempWkt.c_str()); + if (!temp) return 0; + + int r = ever_eq_tbool_bool(temp, arg0); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, ts, arg0); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqTboolBoolPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverEqTboolBoolPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverEqTboolBoolPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqTcbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqTcbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..134e730f74 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqTcbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverEqTcbufferCbufferPhysicalFunction::EverEqTcbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferFunction)); +} + +VarVal EverEqTcbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = ever_eq_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqTcbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "EverEqTcbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return EverEqTcbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqTcbufferTcbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqTcbufferTcbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..be5f58b771 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqTcbufferTcbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverEqTcbufferTcbufferPhysicalFunction::EverEqTcbufferTcbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverEqTcbufferTcbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = ever_eq_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqTcbufferTcbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "EverEqTcbufferTcbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return EverEqTcbufferTcbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..74c123c6e5 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverEqTemporalTemporalPhysicalFunction::EverEqTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverEqTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = ever_eq_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EverEqTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EverEqTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..ef6bd86d95 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverEqTfloatFloatPhysicalFunction::EverEqTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverEqTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_eq_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverEqTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverEqTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqTgeoGeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqTgeoGeoPhysicalFunction.cpp new file mode 100644 index 0000000000..f5dfa1f28c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqTgeoGeoPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverEqTgeoGeoPhysicalFunction::EverEqTgeoGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal EverEqTgeoGeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return ever_eq_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqTgeoGeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EverEqTgeoGeoPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EverEqTgeoGeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqTgeoTgeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqTgeoTgeoPhysicalFunction.cpp new file mode 100644 index 0000000000..f452b50fd3 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqTgeoTgeoPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverEqTgeoTgeoPhysicalFunction::EverEqTgeoTgeoPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverEqTgeoTgeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return ever_eq_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqTgeoTgeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "EverEqTgeoTgeoPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return EverEqTgeoTgeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverEqTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverEqTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..3ec413dbc6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverEqTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverEqTintIntPhysicalFunction::EverEqTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverEqTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_eq_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverEqTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverEqTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverEqTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGeFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGeFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..c1dc1d872c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGeFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGeFloatTfloatPhysicalFunction::EverGeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverGeFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_ge_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGeFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverGeFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverGeFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGeIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGeIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..0c5d369130 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGeIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGeIntTintPhysicalFunction::EverGeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverGeIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_ge_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGeIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverGeIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverGeIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGeTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGeTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..7bd45efb40 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGeTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGeTemporalTemporalPhysicalFunction::EverGeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverGeTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = ever_ge_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGeTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EverGeTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EverGeTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGeTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGeTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..39426a6cc3 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGeTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGeTfloatFloatPhysicalFunction::EverGeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverGeTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_ge_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGeTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverGeTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverGeTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGeTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGeTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..a80daccbf8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGeTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGeTintIntPhysicalFunction::EverGeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverGeTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_ge_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGeTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverGeTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverGeTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGtFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGtFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..456133fbee --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGtFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGtFloatTfloatPhysicalFunction::EverGtFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverGtFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_gt_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGtFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverGtFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverGtFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGtIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGtIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..7ce73b7729 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGtIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGtIntTintPhysicalFunction::EverGtIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverGtIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_gt_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGtIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverGtIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverGtIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGtTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGtTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..11f40c6b03 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGtTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGtTemporalTemporalPhysicalFunction::EverGtTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverGtTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = ever_gt_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGtTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EverGtTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EverGtTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGtTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGtTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..bfbd1769e2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGtTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGtTfloatFloatPhysicalFunction::EverGtTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverGtTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_gt_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGtTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverGtTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverGtTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverGtTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverGtTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..a818505e37 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverGtTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverGtTintIntPhysicalFunction::EverGtTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverGtTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_gt_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverGtTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverGtTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverGtTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLeFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLeFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..6c0a3c63b3 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLeFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLeFloatTfloatPhysicalFunction::EverLeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverLeFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_le_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLeFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverLeFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverLeFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLeIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLeIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..e8d1c731fa --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLeIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLeIntTintPhysicalFunction::EverLeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverLeIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_le_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLeIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverLeIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverLeIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLeTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLeTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..c532f00b59 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLeTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLeTemporalTemporalPhysicalFunction::EverLeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverLeTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = ever_le_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLeTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EverLeTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EverLeTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLeTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLeTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..96f6b4a113 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLeTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLeTfloatFloatPhysicalFunction::EverLeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverLeTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_le_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLeTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverLeTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverLeTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLeTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLeTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..5257a023ca --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLeTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLeTintIntPhysicalFunction::EverLeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverLeTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_le_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLeTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverLeTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverLeTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLtFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLtFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..e3f940b01d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLtFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLtFloatTfloatPhysicalFunction::EverLtFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverLtFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_lt_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLtFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverLtFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverLtFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLtIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLtIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..f452d0328b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLtIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLtIntTintPhysicalFunction::EverLtIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverLtIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_lt_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLtIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverLtIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverLtIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLtTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLtTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..26eec19661 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLtTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLtTemporalTemporalPhysicalFunction::EverLtTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverLtTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = ever_lt_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLtTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EverLtTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EverLtTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLtTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLtTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..7f0f969af8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLtTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLtTfloatFloatPhysicalFunction::EverLtTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverLtTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_lt_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLtTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverLtTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverLtTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverLtTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverLtTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..7fdc387b8d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverLtTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverLtTintIntPhysicalFunction::EverLtTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverLtTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_lt_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverLtTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverLtTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverLtTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeFloatTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeFloatTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..24bcda5466 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeFloatTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverNeFloatTfloatPhysicalFunction::EverNeFloatTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverNeFloatTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_ne_float_tfloat(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeFloatTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverNeFloatTfloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverNeFloatTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeIntTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeIntTintPhysicalFunction.cpp new file mode 100644 index 0000000000..8b50f39b54 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeIntTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverNeIntTintPhysicalFunction::EverNeIntTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverNeIntTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_ne_int_tint(scalarValue, temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeIntTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverNeIntTintPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverNeIntTintPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeTboolBoolPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeTboolBoolPhysicalFunction.cpp new file mode 100644 index 0000000000..fe26b55d92 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeTboolBoolPhysicalFunction.cpp @@ -0,0 +1,98 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverNeTboolBoolPhysicalFunction::EverNeTboolBoolPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal EverNeTboolBoolPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](bool value, + uint64_t ts, + bool arg0) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value ? "t" : "f", MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tbool_in(tempWkt.c_str()); + if (!temp) return 0; + + int r = ever_ne_tbool_bool(temp, arg0); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, ts, arg0); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeTboolBoolPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverNeTboolBoolPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverNeTboolBoolPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeTcbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeTcbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..f8de43fc26 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeTcbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverNeTcbufferCbufferPhysicalFunction::EverNeTcbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferFunction)); +} + +VarVal EverNeTcbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = ever_ne_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeTcbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "EverNeTcbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return EverNeTcbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeTcbufferTcbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeTcbufferTcbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..312c3b5279 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeTcbufferTcbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverNeTcbufferTcbufferPhysicalFunction::EverNeTcbufferTcbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverNeTcbufferTcbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = ever_ne_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeTcbufferTcbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "EverNeTcbufferTcbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return EverNeTcbufferTcbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..cbb17ec22f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverNeTemporalTemporalPhysicalFunction::EverNeTemporalTemporalPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverNeTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = ever_ne_temporal_temporal(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EverNeTemporalTemporalPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EverNeTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeTfloatFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeTfloatFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..af604e2f2f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeTfloatFloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverNeTfloatFloatPhysicalFunction::EverNeTfloatFloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverNeTfloatFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_ne_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeTfloatFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverNeTfloatFloatPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverNeTfloatFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeTgeoGeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeTgeoGeoPhysicalFunction.cpp new file mode 100644 index 0000000000..bf881440e7 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeTgeoGeoPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverNeTgeoGeoPhysicalFunction::EverNeTgeoGeoPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal EverNeTgeoGeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return ever_ne_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeTgeoGeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "EverNeTgeoGeoPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return EverNeTgeoGeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeTgeoTgeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeTgeoTgeoPhysicalFunction.cpp new file mode 100644 index 0000000000..b3a67e8426 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeTgeoTgeoPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +EverNeTgeoTgeoPhysicalFunction::EverNeTgeoTgeoPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal EverNeTgeoTgeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return ever_ne_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeTgeoTgeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "EverNeTgeoTgeoPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return EverNeTgeoTgeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/EverNeTintIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/EverNeTintIntPhysicalFunction.cpp new file mode 100644 index 0000000000..aa4f90f55e --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/EverNeTintIntPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +EverNeTintIntPhysicalFunction::EverNeTintIntPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal EverNeTintIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int valueValue, + uint64_t timestampValue, + int scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = ever_ne_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterEverNeTintIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "EverNeTintIntPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return EverNeTintIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/FrontStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/FrontStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..62c889d142 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/FrontStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +FrontStboxStboxPhysicalFunction::FrontStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal FrontStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = front_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterFrontStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "FrontStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return FrontStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/FrontStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/FrontStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..66818ebfb1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/FrontStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +FrontStboxTspatialPhysicalFunction::FrontStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal FrontStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = front_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterFrontStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "FrontStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return FrontStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/FrontTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/FrontTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..256a73d284 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/FrontTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +FrontTspatialStboxPhysicalFunction::FrontTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal FrontTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = front_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterFrontTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "FrontTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return FrontTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/FrontTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/FrontTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..35e8095aec --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/FrontTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +FrontTspatialTspatialPhysicalFunction::FrontTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal FrontTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return front_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterFrontTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "FrontTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return FrontTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/LeftStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/LeftStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..734830f652 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/LeftStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +LeftStboxStboxPhysicalFunction::LeftStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal LeftStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = left_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterLeftStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "LeftStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return LeftStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/LeftStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/LeftStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..ba3882693b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/LeftStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +LeftStboxTspatialPhysicalFunction::LeftStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal LeftStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = left_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterLeftStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "LeftStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return LeftStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/LeftTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/LeftTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..06f85aa781 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/LeftTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +LeftTboxTnumberPhysicalFunction::LeftTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal LeftTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = left_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterLeftTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "LeftTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return LeftTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/LeftTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/LeftTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..85b7f8b7b9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/LeftTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +LeftTnumberTboxPhysicalFunction::LeftTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal LeftTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = left_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterLeftTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "LeftTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return LeftTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/LeftTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/LeftTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..137e1a217a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/LeftTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +LeftTnumberTnumberPhysicalFunction::LeftTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal LeftTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = left_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterLeftTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "LeftTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return LeftTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/LeftTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/LeftTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..9464cf5316 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/LeftTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +LeftTspatialStboxPhysicalFunction::LeftTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal LeftTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = left_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterLeftTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "LeftTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return LeftTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/LeftTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/LeftTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..519c520058 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/LeftTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +LeftTspatialTspatialPhysicalFunction::LeftTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal LeftTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return left_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterLeftTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "LeftTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return LeftTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..301d1a0424 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +NadStboxStboxPhysicalFunction::NadStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return 0.0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return 0.0; } + + double r = nad_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "NadStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return NadStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadTcbufferStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadTcbufferStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..1cb0b4cc58 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadTcbufferStboxPhysicalFunction.cpp @@ -0,0 +1,116 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +NadTcbufferStboxPhysicalFunction::NadTcbufferStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadTcbufferStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto ts = parameterValues[3].cast>(); + auto arg0 = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + double radius, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0) || radius < 0.0) return 0.0; + std::string tempWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", lon, lat, radius, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tcbuffer_in(tempWkt.c_str()); + if (!temp) return 0.0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return 0.0; } + + double r = nad_tcbuffer_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + lon, lat, radius, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadTcbufferStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "NadTcbufferStboxPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return NadTcbufferStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadTfloatTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadTfloatTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..71aa9cf2ca --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadTfloatTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +NadTfloatTboxPhysicalFunction::NadTfloatTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadTfloatTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0.0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return 0.0; } + + double r = nad_tfloat_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadTfloatTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "NadTfloatTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return NadTfloatTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadTgeoStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadTgeoStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..76c274b9d4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadTgeoStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +NadTgeoStboxPhysicalFunction::NadTgeoStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadTgeoStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return 0.0; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return 0.0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return 0.0; } + + double r = nad_tgeo_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadTgeoStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "NadTgeoStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return NadTgeoStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadTintTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadTintTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..d48ea2e0e8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadTintTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +NadTintTboxPhysicalFunction::NadTintTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadTintTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](int32_t value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tint_in(tempWkt.c_str()); + if (!temp) return 0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return 0; } + + int r = nad_tint_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadTintTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "NadTintTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return NadTintTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadTnpointGeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadTnpointGeoPhysicalFunction.cpp new file mode 100644 index 0000000000..9535b1d983 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadTnpointGeoPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +NadTnpointGeoPhysicalFunction::NadTnpointGeoPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fracFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fracFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadTnpointGeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto frac = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](int64_t rid, + double frac, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (frac < 0.0 || frac > 1.0) return 0.0; + std::string tempWkt = fmt::format("NPoint({},{})@{}", rid, frac, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tnpoint_in(tempWkt.c_str()); + if (!temp) return 0.0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + MEOS::Meos::StaticGeometry arg0G(arg0S); + if (!arg0G.getGeometry()) { free(temp); return 0.0; } + + double r = nad_tnpoint_geo(temp, arg0G.getGeometry()); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + rid, frac, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadTnpointGeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "NadTnpointGeoPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return NadTnpointGeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadTnpointStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadTnpointStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..58d132804d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadTnpointStboxPhysicalFunction.cpp @@ -0,0 +1,111 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +NadTnpointStboxPhysicalFunction::NadTnpointStboxPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fracFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fracFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadTnpointStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto frac = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](int64_t rid, + double frac, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (frac < 0.0 || frac > 1.0) return 0.0; + std::string tempWkt = fmt::format("NPoint({},{})@{}", rid, frac, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tnpoint_in(tempWkt.c_str()); + if (!temp) return 0.0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return 0.0; } + + double r = nad_tnpoint_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + rid, frac, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadTnpointStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "NadTnpointStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return NadTnpointStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadTposeGeoPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadTposeGeoPhysicalFunction.cpp new file mode 100644 index 0000000000..2a4e4ab0a4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadTposeGeoPhysicalFunction.cpp @@ -0,0 +1,114 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +NadTposeGeoPhysicalFunction::NadTposeGeoPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadTposeGeoPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto ts = parameterValues[3].cast>(); + auto arg0 = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double x, + double y, + double theta, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("Pose(Point({} {}),{})@{}", x, y, theta, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tpose_in(tempWkt.c_str()); + if (!temp) return 0.0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + MEOS::Meos::StaticGeometry arg0G(arg0S); + if (!arg0G.getGeometry()) { free(temp); return 0.0; } + + double r = nad_tpose_geo(temp, arg0G.getGeometry()); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + x, y, theta, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadTposeGeoPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "NadTposeGeoPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return NadTposeGeoPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/NadTposeStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/NadTposeStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..299f46b497 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/NadTposeStboxPhysicalFunction.cpp @@ -0,0 +1,115 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +NadTposeStboxPhysicalFunction::NadTposeStboxPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal NadTposeStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto ts = parameterValues[3].cast>(); + auto arg0 = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double x, + double y, + double theta, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("Pose(Point({} {}),{})@{}", x, y, theta, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tpose_in(tempWkt.c_str()); + if (!temp) return 0.0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return 0.0; } + + double r = nad_tpose_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + x, y, theta, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterNadTposeStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "NadTposeStboxPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return NadTposeStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OveraboveStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OveraboveStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..0c4f3d4a74 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OveraboveStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OveraboveStboxStboxPhysicalFunction::OveraboveStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OveraboveStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overabove_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOveraboveStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OveraboveStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OveraboveStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OveraboveStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OveraboveStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..4549409622 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OveraboveStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OveraboveStboxTspatialPhysicalFunction::OveraboveStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OveraboveStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overabove_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOveraboveStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OveraboveStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OveraboveStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OveraboveTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OveraboveTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..482077a326 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OveraboveTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OveraboveTspatialStboxPhysicalFunction::OveraboveTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OveraboveTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overabove_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOveraboveTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OveraboveTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OveraboveTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OveraboveTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OveraboveTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..2352f919d8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OveraboveTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OveraboveTspatialTspatialPhysicalFunction::OveraboveTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OveraboveTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overabove_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOveraboveTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OveraboveTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OveraboveTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverafterStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverafterStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..df687ada6f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverafterStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverafterStboxStboxPhysicalFunction::OverafterStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverafterStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overafter_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverafterStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverafterStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverafterStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverafterStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverafterStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..3f311a0ff7 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverafterStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverafterStboxTspatialPhysicalFunction::OverafterStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverafterStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overafter_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverafterStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverafterStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverafterStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverafterTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverafterTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..2f9417440a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverafterTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverafterTboxTnumberPhysicalFunction::OverafterTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverafterTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overafter_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverafterTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverafterTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverafterTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverafterTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverafterTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..2f247e9e65 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverafterTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverafterTemporalTemporalPhysicalFunction::OverafterTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverafterTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overafter_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverafterTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverafterTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverafterTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverafterTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverafterTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..1b3c59ead2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverafterTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverafterTnumberTboxPhysicalFunction::OverafterTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverafterTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overafter_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverafterTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverafterTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverafterTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverafterTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverafterTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..5fd3efa6c2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverafterTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverafterTnumberTnumberPhysicalFunction::OverafterTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverafterTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = overafter_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverafterTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverafterTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverafterTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverafterTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverafterTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..1a83c9ee97 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverafterTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverafterTspatialStboxPhysicalFunction::OverafterTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverafterTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overafter_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverafterTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverafterTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverafterTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverafterTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverafterTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..073999dbc6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverafterTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverafterTspatialTspatialPhysicalFunction::OverafterTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverafterTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overafter_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverafterTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverafterTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverafterTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbackStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbackStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..865bce908d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbackStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbackStboxStboxPhysicalFunction::OverbackStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbackStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overback_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbackStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverbackStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverbackStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbackStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbackStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..3dbda62f3d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbackStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbackStboxTspatialPhysicalFunction::OverbackStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbackStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overback_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbackStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverbackStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverbackStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbackTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbackTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..5b2aff5851 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbackTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbackTspatialStboxPhysicalFunction::OverbackTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbackTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overback_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbackTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverbackTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverbackTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbackTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbackTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..9cfd611568 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbackTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbackTspatialTspatialPhysicalFunction::OverbackTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverbackTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overback_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbackTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverbackTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverbackTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbeforeStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbeforeStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..5ed7f7d58a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbeforeStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbeforeStboxStboxPhysicalFunction::OverbeforeStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbeforeStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overbefore_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbeforeStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverbeforeStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverbeforeStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbeforeStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbeforeStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..c48e032a06 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbeforeStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbeforeStboxTspatialPhysicalFunction::OverbeforeStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbeforeStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overbefore_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbeforeStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverbeforeStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverbeforeStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbeforeTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbeforeTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..7d81a1def7 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbeforeTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbeforeTboxTnumberPhysicalFunction::OverbeforeTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbeforeTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overbefore_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbeforeTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverbeforeTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverbeforeTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbeforeTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbeforeTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..1198a03a3b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbeforeTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbeforeTemporalTemporalPhysicalFunction::OverbeforeTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverbeforeTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overbefore_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbeforeTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverbeforeTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverbeforeTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbeforeTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbeforeTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..e632bc7a49 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbeforeTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbeforeTnumberTboxPhysicalFunction::OverbeforeTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbeforeTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overbefore_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbeforeTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverbeforeTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverbeforeTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbeforeTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbeforeTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..29458483e2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbeforeTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbeforeTnumberTnumberPhysicalFunction::OverbeforeTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbeforeTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = overbefore_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbeforeTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverbeforeTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverbeforeTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbeforeTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbeforeTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..6dd4388834 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbeforeTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbeforeTspatialStboxPhysicalFunction::OverbeforeTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbeforeTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overbefore_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbeforeTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverbeforeTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverbeforeTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbeforeTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbeforeTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..f48ba77e85 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbeforeTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbeforeTspatialTspatialPhysicalFunction::OverbeforeTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverbeforeTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overbefore_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbeforeTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverbeforeTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverbeforeTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbelowStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbelowStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..2d19a2916a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbelowStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbelowStboxStboxPhysicalFunction::OverbelowStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbelowStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overbelow_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbelowStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverbelowStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverbelowStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbelowStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbelowStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..2ba9e1b266 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbelowStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbelowStboxTspatialPhysicalFunction::OverbelowStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbelowStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overbelow_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbelowStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverbelowStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverbelowStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbelowTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbelowTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..17d88b1571 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbelowTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbelowTspatialStboxPhysicalFunction::OverbelowTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverbelowTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overbelow_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbelowTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverbelowTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverbelowTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverbelowTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverbelowTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..18c70bb4b1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverbelowTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverbelowTspatialTspatialPhysicalFunction::OverbelowTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverbelowTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overbelow_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverbelowTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverbelowTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverbelowTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverfrontStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverfrontStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..bf15872e82 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverfrontStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverfrontStboxStboxPhysicalFunction::OverfrontStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverfrontStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overfront_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverfrontStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverfrontStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverfrontStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverfrontStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverfrontStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..6343bced1b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverfrontStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverfrontStboxTspatialPhysicalFunction::OverfrontStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverfrontStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overfront_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverfrontStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverfrontStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverfrontStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverfrontTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverfrontTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..4b9726c48c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverfrontTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverfrontTspatialStboxPhysicalFunction::OverfrontTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverfrontTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overfront_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverfrontTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverfrontTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverfrontTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverfrontTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverfrontTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..c5638f6559 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverfrontTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverfrontTspatialTspatialPhysicalFunction::OverfrontTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverfrontTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overfront_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverfrontTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverfrontTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverfrontTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverlapsStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverlapsStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..19c283980d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverlapsStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverlapsStboxStboxPhysicalFunction::OverlapsStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverlapsStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overlaps_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverlapsStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverlapsStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverlapsStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverlapsStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverlapsStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..ecad15297a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverlapsStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverlapsStboxTspatialPhysicalFunction::OverlapsStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverlapsStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overlaps_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverlapsStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverlapsStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverlapsStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverlapsTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverlapsTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..d943274eb6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverlapsTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverlapsTboxTnumberPhysicalFunction::OverlapsTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverlapsTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overlaps_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverlapsTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverlapsTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverlapsTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverlapsTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverlapsTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..11a4e4fa56 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverlapsTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverlapsTemporalTemporalPhysicalFunction::OverlapsTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverlapsTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overlaps_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverlapsTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverlapsTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverlapsTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverlapsTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverlapsTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..9ebf7c0fa5 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverlapsTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverlapsTnumberTboxPhysicalFunction::OverlapsTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverlapsTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overlaps_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverlapsTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverlapsTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverlapsTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverlapsTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverlapsTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..08ec2dd8dc --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverlapsTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverlapsTnumberTnumberPhysicalFunction::OverlapsTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverlapsTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = overlaps_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverlapsTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverlapsTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverlapsTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverlapsTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverlapsTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..13c3bb1cfc --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverlapsTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverlapsTspatialStboxPhysicalFunction::OverlapsTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverlapsTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overlaps_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverlapsTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverlapsTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverlapsTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverlapsTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverlapsTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..0637a7f944 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverlapsTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverlapsTspatialTspatialPhysicalFunction::OverlapsTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverlapsTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overlaps_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverlapsTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverlapsTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverlapsTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverleftStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverleftStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..e08ae209a4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverleftStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverleftStboxStboxPhysicalFunction::OverleftStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverleftStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overleft_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverleftStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverleftStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverleftStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverleftStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverleftStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..b638fd4b62 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverleftStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverleftStboxTspatialPhysicalFunction::OverleftStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverleftStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overleft_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverleftStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverleftStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverleftStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverleftTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverleftTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..55375115cf --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverleftTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverleftTboxTnumberPhysicalFunction::OverleftTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverleftTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overleft_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverleftTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverleftTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverleftTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverleftTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverleftTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..7e0f6b510c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverleftTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverleftTnumberTboxPhysicalFunction::OverleftTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverleftTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overleft_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverleftTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverleftTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverleftTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverleftTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverleftTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..21629d3b08 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverleftTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverleftTnumberTnumberPhysicalFunction::OverleftTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverleftTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = overleft_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverleftTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverleftTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverleftTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverleftTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverleftTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..62608ac18f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverleftTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverleftTspatialStboxPhysicalFunction::OverleftTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverleftTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overleft_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverleftTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverleftTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverleftTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverleftTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverleftTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..902bb6ce3b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverleftTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverleftTspatialTspatialPhysicalFunction::OverleftTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverleftTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overleft_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverleftTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverleftTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverleftTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverrightStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverrightStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..a204374bff --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverrightStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverrightStboxStboxPhysicalFunction::OverrightStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverrightStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overright_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverrightStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverrightStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverrightStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverrightStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverrightStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..c6f51b789f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverrightStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverrightStboxTspatialPhysicalFunction::OverrightStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverrightStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overright_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverrightStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverrightStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverrightStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverrightTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverrightTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..240ba2edb2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverrightTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverrightTboxTnumberPhysicalFunction::OverrightTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverrightTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overright_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverrightTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverrightTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverrightTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverrightTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverrightTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..017a0152b9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverrightTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverrightTnumberTboxPhysicalFunction::OverrightTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverrightTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overright_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverrightTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "OverrightTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return OverrightTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverrightTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverrightTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..56ce7996c9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverrightTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverrightTnumberTnumberPhysicalFunction::OverrightTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverrightTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = overright_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverrightTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "OverrightTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return OverrightTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverrightTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverrightTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..a1823ed13e --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverrightTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverrightTspatialStboxPhysicalFunction::OverrightTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal OverrightTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = overright_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverrightTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "OverrightTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return OverrightTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/OverrightTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/OverrightTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..f40ef249c1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/OverrightTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +OverrightTspatialTspatialPhysicalFunction::OverrightTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal OverrightTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return overright_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterOverrightTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "OverrightTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return OverrightTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/RightStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/RightStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..f2fa77c01f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/RightStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +RightStboxStboxPhysicalFunction::RightStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal RightStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = right_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterRightStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "RightStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return RightStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/RightStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/RightStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..1375cea818 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/RightStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +RightStboxTspatialPhysicalFunction::RightStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal RightStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = right_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterRightStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "RightStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return RightStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/RightTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/RightTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..256cadebc0 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/RightTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +RightTboxTnumberPhysicalFunction::RightTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal RightTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = right_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterRightTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "RightTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return RightTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/RightTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/RightTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..1e02ae865a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/RightTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +RightTnumberTboxPhysicalFunction::RightTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal RightTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = right_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterRightTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "RightTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return RightTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/RightTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/RightTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..8ab26eca8c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/RightTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +RightTnumberTnumberPhysicalFunction::RightTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal RightTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = right_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterRightTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "RightTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return RightTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/RightTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/RightTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..22b5ee065a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/RightTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +RightTspatialStboxPhysicalFunction::RightTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal RightTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = right_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterRightTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "RightTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return RightTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/RightTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/RightTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..deb91bd494 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/RightTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +RightTspatialTspatialPhysicalFunction::RightTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal RightTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return right_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterRightTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "RightTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return RightTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/SameStboxStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/SameStboxStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..3765b5b431 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/SameStboxStboxPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +SameStboxStboxPhysicalFunction::SameStboxStboxPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal SameStboxStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = same_stbox_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterSameStboxStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "SameStboxStboxPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return SameStboxStboxPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/SameStboxTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/SameStboxTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..4d180f114c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/SameStboxTspatialPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +SameStboxTspatialPhysicalFunction::SameStboxTspatialPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal SameStboxTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = same_stbox_tspatial(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterSameStboxTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "SameStboxTspatialPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return SameStboxTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/SameTboxTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/SameTboxTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..7e9251c8f8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/SameTboxTnumberPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +SameTboxTnumberPhysicalFunction::SameTboxTnumberPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal SameTboxTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = same_tbox_tnumber(arg0B, temp); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterSameTboxTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "SameTboxTnumberPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return SameTboxTnumberPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/SameTemporalTemporalPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/SameTemporalTemporalPhysicalFunction.cpp new file mode 100644 index 0000000000..8cc24fa1c8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/SameTemporalTemporalPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +SameTemporalTemporalPhysicalFunction::SameTemporalTemporalPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal SameTemporalTemporalPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return same_temporal_temporal(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterSameTemporalTemporalPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "SameTemporalTemporalPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return SameTemporalTemporalPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/SameTnumberTboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/SameTnumberTboxPhysicalFunction.cpp new file mode 100644 index 0000000000..d91b5bfa34 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/SameTnumberTboxPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +SameTnumberTboxPhysicalFunction::SameTnumberTboxPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal SameTnumberTboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + auto arg0 = parameterValues[2].cast(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + TBox* arg0B = tbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = same_tnumber_tbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterSameTnumberTboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "SameTnumberTboxPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return SameTnumberTboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/SameTnumberTnumberPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/SameTnumberTnumberPhysicalFunction.cpp new file mode 100644 index 0000000000..a859244801 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/SameTnumberTnumberPhysicalFunction.cpp @@ -0,0 +1,97 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +SameTnumberTnumberPhysicalFunction::SameTnumberTnumberPhysicalFunction(PhysicalFunction trajFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(trajFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal SameTnumberTnumberPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return false; + std::string arg0Hex(arg0Ptr, arg0Size); + Temporal* arg0T = temporal_from_hexwkb(arg0Hex.c_str()); + if (!arg0T) { free(temp); return false; } + + bool r = same_tnumber_tnumber(temp, arg0T); + free(temp); + free(arg0T); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + traj.getContent(), traj.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterSameTnumberTnumberPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "SameTnumberTnumberPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return SameTnumberTnumberPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/SameTspatialStboxPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/SameTspatialStboxPhysicalFunction.cpp new file mode 100644 index 0000000000..b1c9cfc078 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/SameTspatialStboxPhysicalFunction.cpp @@ -0,0 +1,110 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +SameTspatialStboxPhysicalFunction::SameTspatialStboxPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction tsFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(tsFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal SameTspatialStboxPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + auto arg0 = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + uint64_t ts, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return false; + std::string tempWkt = fmt::format("SRID=4326;Point({} {})@{}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tgeompoint_in(tempWkt.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = same_tspatial_stbox(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + lon, lat, ts, arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterSameTspatialStboxPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "SameTspatialStboxPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return SameTspatialStboxPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/SameTspatialTspatialPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/SameTspatialTspatialPhysicalFunction.cpp new file mode 100644 index 0000000000..ca3267ab82 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/SameTspatialTspatialPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +SameTspatialTspatialPhysicalFunction::SameTspatialTspatialPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal SameTspatialTspatialPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return same_tspatial_tspatial(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterSameTspatialTspatialPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "SameTspatialTspatialPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return SameTspatialTspatialPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/StboxCmpPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/StboxCmpPhysicalFunction.cpp new file mode 100644 index 0000000000..1a9b83561a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/StboxCmpPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +StboxCmpPhysicalFunction::StboxCmpPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal StboxCmpPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return 0; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return 0; } + + int r = stbox_cmp(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterStboxCmpPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "StboxCmpPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return StboxCmpPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/StboxEqPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/StboxEqPhysicalFunction.cpp new file mode 100644 index 0000000000..4cf4cf83b0 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/StboxEqPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +StboxEqPhysicalFunction::StboxEqPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal StboxEqPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = stbox_eq(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterStboxEqPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "StboxEqPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return StboxEqPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/StboxGePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/StboxGePhysicalFunction.cpp new file mode 100644 index 0000000000..30a203efb4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/StboxGePhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +StboxGePhysicalFunction::StboxGePhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal StboxGePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = stbox_ge(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterStboxGePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "StboxGePhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return StboxGePhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/StboxGtPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/StboxGtPhysicalFunction.cpp new file mode 100644 index 0000000000..837b6c95a0 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/StboxGtPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +StboxGtPhysicalFunction::StboxGtPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal StboxGtPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = stbox_gt(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterStboxGtPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "StboxGtPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return StboxGtPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/StboxLePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/StboxLePhysicalFunction.cpp new file mode 100644 index 0000000000..fac3ab1b53 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/StboxLePhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +StboxLePhysicalFunction::StboxLePhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal StboxLePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = stbox_le(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterStboxLePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "StboxLePhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return StboxLePhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/StboxLtPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/StboxLtPhysicalFunction.cpp new file mode 100644 index 0000000000..d3a6e8ccb6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/StboxLtPhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +StboxLtPhysicalFunction::StboxLtPhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal StboxLtPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = stbox_lt(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterStboxLtPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "StboxLtPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return StboxLtPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/StboxNePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/StboxNePhysicalFunction.cpp new file mode 100644 index 0000000000..a6bb4b38fa --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/StboxNePhysicalFunction.cpp @@ -0,0 +1,101 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +StboxNePhysicalFunction::StboxNePhysicalFunction(PhysicalFunction boxFunction, + PhysicalFunction arg0Function) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(boxFunction)); + parameterFunctions.push_back(std::move(arg0Function)); +} + +VarVal StboxNePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto box = parameterValues[0].cast(); + auto arg0 = parameterValues[1].cast(); + + const auto result = nautilus::invoke( + +[](const char* boxPtr, uint32_t boxSize, + const char* arg0Ptr, uint32_t arg0Size) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempS(boxPtr, boxSize); + while (!tempS.empty() && (tempS.front()=='\'' || tempS.front()=='"')) tempS.erase(tempS.begin()); + while (!tempS.empty() && (tempS.back()=='\'' || tempS.back()=='"')) tempS.pop_back(); + STBox* temp = stbox_in(tempS.c_str()); + if (!temp) return false; + std::string arg0S(arg0Ptr, arg0Size); + while (!arg0S.empty() && (arg0S.front()=='\'' || arg0S.front()=='"')) arg0S.erase(arg0S.begin()); + while (!arg0S.empty() && (arg0S.back()=='\'' || arg0S.back()=='"')) arg0S.pop_back(); + STBox* arg0B = stbox_in(arg0S.c_str()); + if (!arg0B) { free(temp); return false; } + + bool r = stbox_ne(temp, arg0B); + free(temp); + free(arg0B); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + box.getContent(), box.getContentSize(), arg0.getContent(), arg0.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterStboxNePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "StboxNePhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return StboxNePhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TboolEndValuePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TboolEndValuePhysicalFunction.cpp new file mode 100644 index 0000000000..4e5afd20b6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TboolEndValuePhysicalFunction.cpp @@ -0,0 +1,93 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TboolEndValuePhysicalFunction::TboolEndValuePhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TboolEndValuePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](bool value, + uint64_t ts) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value ? "t" : "f", MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tbool_in(tempWkt.c_str()); + if (!temp) return false; + + bool r = tbool_end_value(temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTboolEndValuePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TboolEndValuePhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TboolEndValuePhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TboolStartValuePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TboolStartValuePhysicalFunction.cpp new file mode 100644 index 0000000000..9a4f01c35b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TboolStartValuePhysicalFunction.cpp @@ -0,0 +1,93 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TboolStartValuePhysicalFunction::TboolStartValuePhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TboolStartValuePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](bool value, + uint64_t ts) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value ? "t" : "f", MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tbool_in(tempWkt.c_str()); + if (!temp) return false; + + bool r = tbool_start_value(temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return false; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTboolStartValuePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TboolStartValuePhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TboolStartValuePhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TboolToTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TboolToTintPhysicalFunction.cpp new file mode 100644 index 0000000000..193f9625e8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TboolToTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TboolToTintPhysicalFunction::TboolToTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TboolToTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](int32_t value, + uint64_t ts) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tint_in(tempWkt.c_str()); + if (!temp) return 0; + + Temporal* res = tbool_to_tint(temp); + free(temp); + if (!res) return 0; + int r = tint_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTboolToTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TboolToTintPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TboolToTintPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TcbufferToTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TcbufferToTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..ead7d1c882 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TcbufferToTfloatPhysicalFunction.cpp @@ -0,0 +1,107 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TcbufferToTfloatPhysicalFunction::TcbufferToTfloatPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TcbufferToTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto ts = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double lon, + double lat, + double radius, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0) || radius < 0.0) return 0.0; + std::string tempWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", lon, lat, radius, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tcbuffer_in(tempWkt.c_str()); + if (!temp) return 0.0; + + Temporal* res = tcbuffer_to_tfloat(temp); + free(temp); + if (!res) return 0.0; + double r = tfloat_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + lon, lat, radius, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTcbufferToTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TcbufferToTfloatPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TcbufferToTfloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAContainsGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAContainsGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..46dd387913 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAContainsGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAContainsGeometryPhysicalFunction::TemporalAContainsGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalAContainsGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return acontains_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAContainsGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalAContainsGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalAContainsGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAContainsTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..35ce6a2897 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAContainsTCbufferCbufferPhysicalFunction::TemporalAContainsTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalAContainsTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = acontains_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalAContainsTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalAContainsTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAContainsTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..a3b52dfb06 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAContainsTCbufferPhysicalFunction::TemporalAContainsTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalAContainsTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = acontains_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalAContainsTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalAContainsTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAContainsTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..b1f3aaa9da --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAContainsTGeometryPhysicalFunction::TemporalAContainsTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalAContainsTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return acontains_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalAContainsTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalAContainsTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAContainsTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..9117a27506 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalAContainsTNpointGeometryPhysicalFunction::TemporalAContainsTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalAContainsTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = acontains_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalAContainsTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalAContainsTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAContainsTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..e347e885d8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalAContainsTNpointTNpointPhysicalFunction::TemporalAContainsTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalAContainsTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = acontains_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalAContainsTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalAContainsTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAContainsTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..6cfcceb550 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalAContainsTPoseGeometryPhysicalFunction::TemporalAContainsTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalAContainsTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = acontains_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalAContainsTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalAContainsTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAContainsTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..4c41e64de6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAContainsTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalAContainsTPoseTPosePhysicalFunction::TemporalAContainsTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalAContainsTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = acontains_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAContainsTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalAContainsTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalAContainsTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalACoversTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalACoversTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..46ba72cfb8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalACoversTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalACoversTCbufferCbufferPhysicalFunction::TemporalACoversTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalACoversTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = acovers_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalACoversTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalACoversTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalACoversTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalACoversTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalACoversTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..2c4bc0dfd3 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalACoversTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalACoversTCbufferPhysicalFunction::TemporalACoversTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalACoversTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = acovers_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalACoversTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalACoversTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalACoversTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..c7b624cae2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinGeometryPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADWithinGeometryPhysicalFunction::TemporalADWithinGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + auto dist = parameterValues[4].cast>(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS *_tgeo_geo with trailing distance arg + // — int fn(const Temporal*, const GSERIALIZED*, double). + return adwithin_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry(), + distValue); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalADWithinGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalADWithinGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..b8acf099e0 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADWithinTCbufferCbufferPhysicalFunction::TemporalADWithinTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonValue, double latValue, double radiusValue, uint64_t timestampValue, + const char* cbufLitPtr, uint32_t cbufLitSize, double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = adwithin_tcbuffer_cbuffer(tcbuffer, cb, distValue); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalADWithinTCbufferCbufferPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalADWithinTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..38778bc42b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferGeometryPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADWithinTCbufferGeometryPhysicalFunction::TemporalADWithinTCbufferGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinTCbufferGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonValue, double latValue, double radiusValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = adwithin_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry(), distValue); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTCbufferGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalADWithinTCbufferGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalADWithinTCbufferGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..c309e7452d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,132 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADWithinTCbufferTCbufferPhysicalFunction::TemporalADWithinTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(9); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + auto dist = parameterValues[8].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = adwithin_tcbuffer_tcbuffer(tA, tB, distValue); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 9, + "TemporalADWithinTCbufferTCbufferPhysicalFunction requires 9 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + auto arg8 = std::move(arguments.childFunctions[8]); + return TemporalADWithinTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7), std::move(arg8)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..7a77d53a0a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADWithinTGeometryPhysicalFunction::TemporalADWithinTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(7); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + auto dist = parameterValues[6].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo with trailing distance arg + // — int fn(const Temporal*, const Temporal*, double). + return adwithin_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry(), + distValue); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB, dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 7, + "TemporalADWithinTGeometryPhysicalFunction requires 7 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + return TemporalADWithinTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..da99a247fc --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,122 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalADWithinTNpointGeometryPhysicalFunction::TemporalADWithinTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + auto dist = parameterValues[4].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = adwithin_tgeo_geo(tgeo, staticGeometry.getGeometry(), distValue); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalADWithinTNpointGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalADWithinTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..3f2423f4dd --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalADWithinTNpointTNpointPhysicalFunction::TemporalADWithinTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(7); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + auto dist = parameterValues[6].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = adwithin_tgeo_tgeo(tgeoA, tgeoB, distValue); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB, dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 7, + "TemporalADWithinTNpointTNpointPhysicalFunction requires 7 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + return TemporalADWithinTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..a7a4aa8702 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalADWithinTPoseGeometryPhysicalFunction::TemporalADWithinTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = adwithin_tgeo_geo(tgeo, staticGeometry.getGeometry(), distValue); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalADWithinTPoseGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalADWithinTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADWithinTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..988729ce54 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADWithinTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,141 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalADWithinTPoseTPosePhysicalFunction::TemporalADWithinTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(9); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalADWithinTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + auto dist = parameterValues[8].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = adwithin_tgeo_tgeo(tgeoA, tgeoB, distValue); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB, dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADWithinTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 9, + "TemporalADWithinTPoseTPosePhysicalFunction requires 9 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + auto arg8 = std::move(arguments.childFunctions[8]); + return TemporalADWithinTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7), std::move(arg8)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..98880a767c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADisjointGeometryPhysicalFunction::TemporalADisjointGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalADisjointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return adisjoint_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalADisjointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalADisjointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..734e1b0b42 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADisjointTCbufferCbufferPhysicalFunction::TemporalADisjointTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalADisjointTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = adisjoint_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalADisjointTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalADisjointTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..24aab94588 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADisjointTCbufferPhysicalFunction::TemporalADisjointTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalADisjointTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = adisjoint_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalADisjointTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalADisjointTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..7c51d596d4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADisjointTCbufferTCbufferPhysicalFunction::TemporalADisjointTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalADisjointTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = adisjoint_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalADisjointTCbufferTCbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalADisjointTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..78da042055 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalADisjointTGeometryPhysicalFunction::TemporalADisjointTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalADisjointTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return adisjoint_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalADisjointTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalADisjointTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..dff22a4085 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalADisjointTNpointGeometryPhysicalFunction::TemporalADisjointTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalADisjointTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = adisjoint_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalADisjointTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalADisjointTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..8a07cc2dfb --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalADisjointTNpointTNpointPhysicalFunction::TemporalADisjointTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalADisjointTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = adisjoint_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalADisjointTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalADisjointTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..c83756ca94 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalADisjointTPoseGeometryPhysicalFunction::TemporalADisjointTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalADisjointTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = adisjoint_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalADisjointTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalADisjointTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalADisjointTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..4c762fbfc1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalADisjointTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalADisjointTPoseTPosePhysicalFunction::TemporalADisjointTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalADisjointTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = adisjoint_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalADisjointTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalADisjointTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalADisjointTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..e18e1653ff --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAIntersectsTCbufferCbufferPhysicalFunction::TemporalAIntersectsTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalAIntersectsTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = aintersects_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalAIntersectsTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalAIntersectsTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..30b9298f61 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAIntersectsTCbufferPhysicalFunction::TemporalAIntersectsTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalAIntersectsTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = aintersects_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalAIntersectsTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalAIntersectsTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..3ca3c6478b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAIntersectsTCbufferTCbufferPhysicalFunction::TemporalAIntersectsTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalAIntersectsTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = aintersects_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalAIntersectsTCbufferTCbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalAIntersectsTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..7a958dccf9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAIntersectsTGeometryPhysicalFunction::TemporalAIntersectsTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalAIntersectsTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return aintersects_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalAIntersectsTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalAIntersectsTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..a50638053f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalAIntersectsTNpointGeometryPhysicalFunction::TemporalAIntersectsTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalAIntersectsTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = aintersects_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalAIntersectsTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalAIntersectsTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..daa80b7093 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalAIntersectsTNpointTNpointPhysicalFunction::TemporalAIntersectsTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalAIntersectsTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = aintersects_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalAIntersectsTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalAIntersectsTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..98370112a6 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalAIntersectsTPoseGeometryPhysicalFunction::TemporalAIntersectsTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalAIntersectsTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = aintersects_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalAIntersectsTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalAIntersectsTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..f583c92e19 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAIntersectsTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalAIntersectsTPoseTPosePhysicalFunction::TemporalAIntersectsTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalAIntersectsTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = aintersects_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAIntersectsTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalAIntersectsTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalAIntersectsTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..5f52041227 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalATouchesGeometryPhysicalFunction::TemporalATouchesGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalATouchesGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return atouches_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalATouchesGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalATouchesGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..40827fa6dc --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalATouchesTCbufferCbufferPhysicalFunction::TemporalATouchesTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalATouchesTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = atouches_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalATouchesTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalATouchesTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..8fea0f9319 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalATouchesTCbufferPhysicalFunction::TemporalATouchesTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalATouchesTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = atouches_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalATouchesTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalATouchesTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..db67648002 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalATouchesTCbufferTCbufferPhysicalFunction::TemporalATouchesTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalATouchesTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = atouches_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalATouchesTCbufferTCbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalATouchesTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..5befc70bec --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalATouchesTGeometryPhysicalFunction::TemporalATouchesTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalATouchesTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return atouches_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalATouchesTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalATouchesTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..83b47a5f65 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalATouchesTNpointGeometryPhysicalFunction::TemporalATouchesTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalATouchesTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = atouches_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalATouchesTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalATouchesTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..9efb004284 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalATouchesTNpointTNpointPhysicalFunction::TemporalATouchesTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalATouchesTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = atouches_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalATouchesTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalATouchesTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..b8b52bd58d --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalATouchesTPoseGeometryPhysicalFunction::TemporalATouchesTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalATouchesTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = atouches_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalATouchesTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalATouchesTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalATouchesTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..65767e2a08 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalATouchesTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalATouchesTPoseTPosePhysicalFunction::TemporalATouchesTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalATouchesTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = atouches_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalATouchesTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalATouchesTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalATouchesTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalAtGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalAtGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..ab946b1f10 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalAtGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalAtGeometryPhysicalFunction::TemporalAtGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalAtGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS restriction call — returns Temporal* (non-null if the + // input survived the restriction, null if clipped/empty). + // For per-event single-instant inputs this collapses to a + // filter predicate: 1 if the point survives, 0 if clipped. + Temporal* clipped = tgeo_at_geom(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + if (clipped == nullptr) return 0; + free(clipped); + return 1; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalAtGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalAtGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalAtGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalCmpPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalCmpPhysicalFunction.cpp new file mode 100644 index 0000000000..7367f4f9e8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalCmpPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalCmpPhysicalFunction::TemporalCmpPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalCmpPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_cmp(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalCmpPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalCmpPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalCmpPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalDyntimewarpDistancePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalDyntimewarpDistancePhysicalFunction.cpp new file mode 100644 index 0000000000..dd90cc00ba --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalDyntimewarpDistancePhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalDyntimewarpDistancePhysicalFunction::TemporalDyntimewarpDistancePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalDyntimewarpDistancePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_dyntimewarp_distance(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalDyntimewarpDistancePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalDyntimewarpDistancePhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalDyntimewarpDistancePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEContainsTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..4354a43847 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEContainsTCbufferCbufferPhysicalFunction::TemporalEContainsTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalEContainsTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = econtains_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEContainsTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEContainsTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEContainsTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..59f23fcf45 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEContainsTCbufferPhysicalFunction::TemporalEContainsTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEContainsTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = econtains_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEContainsTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEContainsTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEContainsTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..05b5b13dd4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEContainsTGeometryPhysicalFunction::TemporalEContainsTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEContainsTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return econtains_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEContainsTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEContainsTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEContainsTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..e895fbcd94 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEContainsTNpointGeometryPhysicalFunction::TemporalEContainsTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEContainsTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = econtains_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalEContainsTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalEContainsTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEContainsTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..b435a68713 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEContainsTNpointTNpointPhysicalFunction::TemporalEContainsTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEContainsTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = econtains_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEContainsTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEContainsTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEContainsTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..3ac62f1c41 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEContainsTPoseGeometryPhysicalFunction::TemporalEContainsTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEContainsTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = econtains_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEContainsTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEContainsTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEContainsTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..aea0df7fc9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEContainsTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEContainsTPoseTPosePhysicalFunction::TemporalEContainsTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEContainsTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = econtains_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEContainsTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalEContainsTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalEContainsTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..58cd90da42 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalECoversGeometryPhysicalFunction::TemporalECoversGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalECoversGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return ecovers_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalECoversGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalECoversGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..3dec7d4dea --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalECoversTCbufferCbufferPhysicalFunction::TemporalECoversTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalECoversTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = ecovers_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalECoversTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalECoversTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..8bcadf9d84 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalECoversTCbufferPhysicalFunction::TemporalECoversTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalECoversTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = ecovers_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalECoversTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalECoversTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..31e2d7115a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalECoversTCbufferTCbufferPhysicalFunction::TemporalECoversTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalECoversTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = ecovers_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalECoversTCbufferTCbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalECoversTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..e3f779641c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalECoversTGeometryPhysicalFunction::TemporalECoversTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalECoversTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return ecovers_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalECoversTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalECoversTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..b5ea18d1a0 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalECoversTNpointGeometryPhysicalFunction::TemporalECoversTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalECoversTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = ecovers_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalECoversTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalECoversTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..000b4cd7b5 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalECoversTNpointTNpointPhysicalFunction::TemporalECoversTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalECoversTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = ecovers_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalECoversTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalECoversTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..6cf9f98956 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalECoversTPoseGeometryPhysicalFunction::TemporalECoversTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalECoversTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = ecovers_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalECoversTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalECoversTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalECoversTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalECoversTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..57e165f1e4 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalECoversTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalECoversTPoseTPosePhysicalFunction::TemporalECoversTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalECoversTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = ecovers_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalECoversTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalECoversTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalECoversTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..47923bc6d3 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEDWithinTCbufferCbufferPhysicalFunction::TemporalEDWithinTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalEDWithinTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonValue, double latValue, double radiusValue, uint64_t timestampValue, + const char* cbufLitPtr, uint32_t cbufLitSize, double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = edwithin_tcbuffer_cbuffer(tcbuffer, cb, distValue); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEDWithinTCbufferCbufferPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEDWithinTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..8477de56e0 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferGeometryPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEDWithinTCbufferGeometryPhysicalFunction::TemporalEDWithinTCbufferGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalEDWithinTCbufferGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonValue, double latValue, double radiusValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = edwithin_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry(), distValue); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTCbufferGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEDWithinTCbufferGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEDWithinTCbufferGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..2733cef0ff --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,132 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEDWithinTCbufferTCbufferPhysicalFunction::TemporalEDWithinTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(9); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalEDWithinTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + auto dist = parameterValues[8].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = edwithin_tcbuffer_tcbuffer(tA, tB, distValue); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 9, + "TemporalEDWithinTCbufferTCbufferPhysicalFunction requires 9 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + auto arg8 = std::move(arguments.childFunctions[8]); + return TemporalEDWithinTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7), std::move(arg8)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..7dbe6d5745 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEDWithinTGeometryPhysicalFunction::TemporalEDWithinTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(7); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalEDWithinTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + auto dist = parameterValues[6].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo with trailing distance arg + // — int fn(const Temporal*, const Temporal*, double). + return edwithin_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry(), + distValue); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB, dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 7, + "TemporalEDWithinTGeometryPhysicalFunction requires 7 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + return TemporalEDWithinTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..e90a95349b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,122 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEDWithinTNpointGeometryPhysicalFunction::TemporalEDWithinTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalEDWithinTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + auto dist = parameterValues[4].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = edwithin_tgeo_geo(tgeo, staticGeometry.getGeometry(), distValue); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEDWithinTNpointGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEDWithinTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..724348f800 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,131 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEDWithinTNpointTNpointPhysicalFunction::TemporalEDWithinTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(7); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalEDWithinTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + auto dist = parameterValues[6].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = edwithin_tgeo_tgeo(tgeoA, tgeoB, distValue); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB, dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 7, + "TemporalEDWithinTNpointTNpointPhysicalFunction requires 7 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + return TemporalEDWithinTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..b2fb976ef9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,128 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEDWithinTPoseGeometryPhysicalFunction::TemporalEDWithinTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalEDWithinTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = edwithin_tgeo_geo(tgeo, staticGeometry.getGeometry(), distValue); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEDWithinTPoseGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEDWithinTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..36f2ef4921 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDWithinTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,141 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEDWithinTPoseTPosePhysicalFunction::TemporalEDWithinTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction, + PhysicalFunction distFunction) +{ + parameterFunctions.reserve(9); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); + parameterFunctions.push_back(std::move(distFunction)); +} + +VarVal TemporalEDWithinTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + auto dist = parameterValues[8].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue, + double distValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = edwithin_tgeo_tgeo(tgeoA, tgeoB, distValue); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB, dist); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDWithinTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 9, + "TemporalEDWithinTPoseTPosePhysicalFunction requires 9 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + auto arg8 = std::move(arguments.childFunctions[8]); + return TemporalEDWithinTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7), std::move(arg8)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDisjointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..495dc71785 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEDisjointGeometryPhysicalFunction::TemporalEDisjointGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEDisjointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return edisjoint_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalEDisjointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalEDisjointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..948c9cb2bc --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEDisjointTCbufferCbufferPhysicalFunction::TemporalEDisjointTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalEDisjointTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = edisjoint_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEDisjointTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEDisjointTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..1fee5ab0bf --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEDisjointTCbufferPhysicalFunction::TemporalEDisjointTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEDisjointTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = edisjoint_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEDisjointTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEDisjointTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..1ca54a8fc9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEDisjointTGeometryPhysicalFunction::TemporalEDisjointTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEDisjointTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return edisjoint_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEDisjointTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEDisjointTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..46f7468653 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEDisjointTNpointGeometryPhysicalFunction::TemporalEDisjointTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEDisjointTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = edisjoint_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalEDisjointTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalEDisjointTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..382139b115 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEDisjointTNpointTNpointPhysicalFunction::TemporalEDisjointTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEDisjointTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = edisjoint_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEDisjointTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEDisjointTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..ecc47f1b43 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEDisjointTPoseGeometryPhysicalFunction::TemporalEDisjointTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEDisjointTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = edisjoint_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEDisjointTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEDisjointTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..b80c5ba86b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEDisjointTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEDisjointTPoseTPosePhysicalFunction::TemporalEDisjointTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEDisjointTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = edisjoint_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEDisjointTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalEDisjointTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalEDisjointTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..847b2cf06a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEIntersectsGeometryPhysicalFunction::TemporalEIntersectsGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEIntersectsGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return eintersects_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalEIntersectsGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalEIntersectsGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..d41dd7bdbb --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEIntersectsTCbufferCbufferPhysicalFunction::TemporalEIntersectsTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalEIntersectsTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = eintersects_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEIntersectsTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEIntersectsTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..e35995fa24 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEIntersectsTCbufferPhysicalFunction::TemporalEIntersectsTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEIntersectsTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = eintersects_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEIntersectsTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEIntersectsTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..2edfa8b7e8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEIntersectsTCbufferTCbufferPhysicalFunction::TemporalEIntersectsTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEIntersectsTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = eintersects_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalEIntersectsTCbufferTCbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalEIntersectsTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..2654e596fd --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEIntersectsTGeometryPhysicalFunction::TemporalEIntersectsTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEIntersectsTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return eintersects_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEIntersectsTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEIntersectsTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..f725c4834c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEIntersectsTNpointGeometryPhysicalFunction::TemporalEIntersectsTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEIntersectsTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = eintersects_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalEIntersectsTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalEIntersectsTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..e958e3f6dd --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEIntersectsTNpointTNpointPhysicalFunction::TemporalEIntersectsTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEIntersectsTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = eintersects_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEIntersectsTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEIntersectsTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..02a357ae40 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEIntersectsTPoseGeometryPhysicalFunction::TemporalEIntersectsTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalEIntersectsTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = eintersects_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalEIntersectsTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalEIntersectsTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..a0ae84b98f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEIntersectsTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalEIntersectsTPoseTPosePhysicalFunction::TemporalEIntersectsTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEIntersectsTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = eintersects_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEIntersectsTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalEIntersectsTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalEIntersectsTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..b66b50a0d0 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalETouchesGeometryPhysicalFunction::TemporalETouchesGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalETouchesGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return etouches_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalETouchesGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalETouchesGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..2d77b52141 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalETouchesTCbufferCbufferPhysicalFunction::TemporalETouchesTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLitFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLitFunction)); +} + +VarVal TemporalETouchesTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + int r = etouches_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalETouchesTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalETouchesTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..ae6e9b6a87 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalETouchesTCbufferPhysicalFunction::TemporalETouchesTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalETouchesTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + int r = etouches_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalETouchesTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalETouchesTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..28ab4beb81 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalETouchesTCbufferTCbufferPhysicalFunction::TemporalETouchesTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalETouchesTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + int r = etouches_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalETouchesTCbufferTCbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalETouchesTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..092df2a3cf --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalETouchesTGeometryPhysicalFunction::TemporalETouchesTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalETouchesTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return etouches_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalETouchesTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalETouchesTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..1d5cac5d68 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalETouchesTNpointGeometryPhysicalFunction::TemporalETouchesTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalETouchesTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + int r = etouches_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalETouchesTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalETouchesTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..7c6c5ceb1f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalETouchesTNpointTNpointPhysicalFunction::TemporalETouchesTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalETouchesTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + int r = etouches_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalETouchesTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalETouchesTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..762fb564bb --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalETouchesTPoseGeometryPhysicalFunction::TemporalETouchesTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalETouchesTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + int r = etouches_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalETouchesTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalETouchesTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalETouchesTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..b3de0feea9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalETouchesTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalETouchesTPoseTPosePhysicalFunction::TemporalETouchesTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalETouchesTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + int r = etouches_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalETouchesTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalETouchesTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalETouchesTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalEqPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalEqPhysicalFunction.cpp new file mode 100644 index 0000000000..1dfc04f603 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalEqPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalEqPhysicalFunction::TemporalEqPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalEqPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_eq(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalEqPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalEqPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalEqPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalFrechetDistancePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalFrechetDistancePhysicalFunction.cpp new file mode 100644 index 0000000000..66eab726e5 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalFrechetDistancePhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalFrechetDistancePhysicalFunction::TemporalFrechetDistancePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalFrechetDistancePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_frechet_distance(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalFrechetDistancePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalFrechetDistancePhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalFrechetDistancePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalGePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalGePhysicalFunction.cpp new file mode 100644 index 0000000000..7c48cd5f5b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalGePhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalGePhysicalFunction::TemporalGePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalGePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_ge(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalGePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalGePhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalGePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalGtPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalGtPhysicalFunction.cpp new file mode 100644 index 0000000000..6092d863f9 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalGtPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalGtPhysicalFunction::TemporalGtPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalGtPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_gt(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalGtPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalGtPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalGtPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalHausdorffDistancePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalHausdorffDistancePhysicalFunction.cpp new file mode 100644 index 0000000000..6b128a6a6f --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalHausdorffDistancePhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalHausdorffDistancePhysicalFunction::TemporalHausdorffDistancePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalHausdorffDistancePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_hausdorff_distance(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalHausdorffDistancePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalHausdorffDistancePhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalHausdorffDistancePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalLePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalLePhysicalFunction.cpp new file mode 100644 index 0000000000..1062d98703 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalLePhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalLePhysicalFunction::TemporalLePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalLePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_le(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalLePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalLePhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalLePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalLtPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalLtPhysicalFunction.cpp new file mode 100644 index 0000000000..b8b2a398dd --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalLtPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalLtPhysicalFunction::TemporalLtPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalLtPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_lt(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalLtPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalLtPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalLtPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalMinusGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalMinusGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..f0b5ff6ead --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalMinusGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalMinusGeometryPhysicalFunction::TemporalMinusGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalMinusGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS restriction call — returns Temporal* (non-null if the + // input survived the restriction, null if clipped/empty). + // For per-event single-instant inputs this collapses to a + // filter predicate: 1 if the point survives, 0 if clipped. + Temporal* clipped = tgeo_minus_geom(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + if (clipped == nullptr) return 0; + free(clipped); + return 1; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalMinusGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalMinusGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalMinusGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADFloatScalarPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADFloatScalarPhysicalFunction.cpp new file mode 100644 index 0000000000..501c547061 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADFloatScalarPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +TemporalNADFloatScalarPhysicalFunction::TemporalNADFloatScalarPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal TemporalNADFloatScalarPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](double valueValue, + uint64_t timestampValue, + double scalarValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tfloat_in(wkt.c_str()); + if (!temp) return 0; + double r = nad_tfloat_float(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADFloatScalarPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "TemporalNADFloatScalarPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return TemporalNADFloatScalarPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..d91eafb8b2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalNADGeometryPhysicalFunction::TemporalNADGeometryPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalNADGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) { + return 0; + } + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({} {})@{}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return nad_tgeo_geo(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalNADGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalNADGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADIntScalarPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADIntScalarPhysicalFunction.cpp new file mode 100644 index 0000000000..535d95c8d8 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADIntScalarPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +TemporalNADIntScalarPhysicalFunction::TemporalNADIntScalarPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction timestampFunction, + PhysicalFunction scalarFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(scalarFunction)); +} + +VarVal TemporalNADIntScalarPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int32_t valueValue, + uint64_t timestampValue, + int32_t scalarValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{}@{}", valueValue, tsString); + Temporal* temp = tint_in(wkt.c_str()); + if (!temp) return 0; + int r = nad_tint_int(temp, scalarValue); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, timestamp, scalar); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADIntScalarPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "TemporalNADIntScalarPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return TemporalNADIntScalarPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..b7165915cb --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferCbufferPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalNADTCbufferCbufferPhysicalFunction::TemporalNADTCbufferCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction cbufferLiteralFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(cbufferLiteralFunction)); +} + +VarVal TemporalNADTCbufferCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) { free(tcbuffer); return 0; } + + double r = nad_tcbuffer_cbuffer(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTCbufferCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalNADTCbufferCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalNADTCbufferCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..20e2a8f9a2 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferPhysicalFunction.cpp @@ -0,0 +1,125 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalNADTCbufferPhysicalFunction::TemporalNADTCbufferPhysicalFunction(PhysicalFunction lonFunction, + PhysicalFunction latFunction, + PhysicalFunction radiusFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(lonFunction)); + parameterFunctions.push_back(std::move(latFunction)); + parameterFunctions.push_back(std::move(radiusFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalNADTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({} {}),{})@{}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tcbuffer); return 0; } + + double r = nad_tcbuffer_geo(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalNADTCbufferPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalNADTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferTCbufferPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferTCbufferPhysicalFunction.cpp new file mode 100644 index 0000000000..a2703901eb --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTCbufferTCbufferPhysicalFunction.cpp @@ -0,0 +1,127 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalNADTCbufferTCbufferPhysicalFunction::TemporalNADTCbufferTCbufferPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction radiusAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction radiusBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(radiusAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(radiusBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalNADTCbufferTCbufferPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({} {}),{})@{}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({} {}),{})@{}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) { free(tA); return 0; } + + double r = nad_tcbuffer_tcbuffer(tA, tB); + free(tA); + free(tB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTCbufferTCbufferPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalNADTCbufferTCbufferPhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalNADTCbufferTCbufferPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTFloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTFloatPhysicalFunction.cpp new file mode 100644 index 0000000000..5cb88b6b93 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTFloatPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +TemporalNADTFloatPhysicalFunction::TemporalNADTFloatPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalNADTFloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](double valueAValue, uint64_t tsAValue, + double valueBValue, uint64_t tsBValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tfloat_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tfloat_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + double r = nad_tfloat_tfloat(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTFloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalNADTFloatPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalNADTFloatPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..5afa3d52bc --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTGeometryPhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalNADTGeometryPhysicalFunction::TemporalNADTGeometryPhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalNADTGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return nad_tgeo_tgeo(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalNADTGeometryPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalNADTGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTIntPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTIntPhysicalFunction.cpp new file mode 100644 index 0000000000..0f13bb8836 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTIntPhysicalFunction.cpp @@ -0,0 +1,104 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace NES { + +TemporalNADTIntPhysicalFunction::TemporalNADTIntPhysicalFunction(PhysicalFunction valueAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction valueBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(valueAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(valueBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalNADTIntPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[](int32_t valueAValue, uint64_t tsAValue, + int32_t valueBValue, uint64_t tsBValue) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{}@{}", valueAValue, tsAStr); + std::string wktB = fmt::format("{}@{}", valueBValue, tsBStr); + Temporal* tempA = tint_in(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = tint_in(wktB.c_str()); + if (!tempB) { free(tempA); return 0; } + int r = nad_tint_tint(tempA, tempB); + free(tempA); + free(tempB); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + valueA, tsA, valueB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTIntPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalNADTIntPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalNADTIntPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTNpointGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTNpointGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..0fcdb346b0 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTNpointGeometryPhysicalFunction.cpp @@ -0,0 +1,118 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalNADTNpointGeometryPhysicalFunction::TemporalNADTNpointGeometryPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fractionFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(4); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fractionFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalNADTNpointGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({}, {})@{}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) { free(tnpoint); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tnpoint); return 0; } + + double r = nad_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTNpointGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 4, + "TemporalNADTNpointGeometryPhysicalFunction requires 4 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + return TemporalNADTNpointGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTNpointTNpointPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTNpointTNpointPhysicalFunction.cpp new file mode 100644 index 0000000000..7a983a6778 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTNpointTNpointPhysicalFunction.cpp @@ -0,0 +1,126 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalNADTNpointTNpointPhysicalFunction::TemporalNADTNpointTNpointPhysicalFunction(PhysicalFunction ridAFunction, + PhysicalFunction fractionAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction ridBFunction, + PhysicalFunction fractionBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(ridAFunction)); + parameterFunctions.push_back(std::move(fractionAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(ridBFunction)); + parameterFunctions.push_back(std::move(fractionBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalNADTNpointTNpointPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({}, {})@{}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({}, {})@{}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) { free(tnpointA); return 0; } + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) { free(tgeoA); free(tnpointA); return 0; } + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) { free(tnpointB); free(tgeoA); free(tnpointA); return 0; } + + double r = nad_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTNpointTNpointPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalNADTNpointTNpointPhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalNADTNpointTNpointPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTPoseGeometryPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTPoseGeometryPhysicalFunction.cpp new file mode 100644 index 0000000000..2a01203e48 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTPoseGeometryPhysicalFunction.cpp @@ -0,0 +1,124 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalNADTPoseGeometryPhysicalFunction::TemporalNADTPoseGeometryPhysicalFunction(PhysicalFunction xFunction, + PhysicalFunction yFunction, + PhysicalFunction thetaFunction, + PhysicalFunction timestampFunction, + PhysicalFunction geometryFunction) +{ + parameterFunctions.reserve(5); + parameterFunctions.push_back(std::move(xFunction)); + parameterFunctions.push_back(std::move(yFunction)); + parameterFunctions.push_back(std::move(thetaFunction)); + parameterFunctions.push_back(std::move(timestampFunction)); + parameterFunctions.push_back(std::move(geometryFunction)); +} + +VarVal TemporalNADTPoseGeometryPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({} {}), {})@{}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) { free(tpose); return 0; } + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) { free(tgeo); free(tpose); return 0; } + + double r = nad_tgeo_geo(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTPoseGeometryPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 5, + "TemporalNADTPoseGeometryPhysicalFunction requires 5 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + return TemporalNADTPoseGeometryPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNADTPoseTPosePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNADTPoseTPosePhysicalFunction.cpp new file mode 100644 index 0000000000..8e657790aa --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNADTPoseTPosePhysicalFunction.cpp @@ -0,0 +1,136 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +namespace NES { + +TemporalNADTPoseTPosePhysicalFunction::TemporalNADTPoseTPosePhysicalFunction(PhysicalFunction xAFunction, + PhysicalFunction yAFunction, + PhysicalFunction thetaAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction xBFunction, + PhysicalFunction yBFunction, + PhysicalFunction thetaBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(8); + parameterFunctions.push_back(std::move(xAFunction)); + parameterFunctions.push_back(std::move(yAFunction)); + parameterFunctions.push_back(std::move(thetaAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(xBFunction)); + parameterFunctions.push_back(std::move(yBFunction)); + parameterFunctions.push_back(std::move(thetaBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalNADTPoseTPosePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({} {}), {})@{}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({} {}), {})@{}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) { free(tposeA); return 0; } + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) { free(tgeoA); free(tposeA); return 0; } + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) { free(tposeB); free(tgeoA); free(tposeA); return 0; } + + double r = nad_tgeo_tgeo(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNADTPoseTPosePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 8, + "TemporalNADTPoseTPosePhysicalFunction requires 8 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + auto arg6 = std::move(arguments.childFunctions[6]); + auto arg7 = std::move(arguments.childFunctions[7]); + return TemporalNADTPoseTPosePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5), std::move(arg6), std::move(arg7)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TemporalNePhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TemporalNePhysicalFunction.cpp new file mode 100644 index 0000000000..15a72ce79a --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TemporalNePhysicalFunction.cpp @@ -0,0 +1,117 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TemporalNePhysicalFunction::TemporalNePhysicalFunction(PhysicalFunction lonAFunction, + PhysicalFunction latAFunction, + PhysicalFunction tsAFunction, + PhysicalFunction lonBFunction, + PhysicalFunction latBFunction, + PhysicalFunction tsBFunction) +{ + parameterFunctions.reserve(6); + parameterFunctions.push_back(std::move(lonAFunction)); + parameterFunctions.push_back(std::move(latAFunction)); + parameterFunctions.push_back(std::move(tsAFunction)); + parameterFunctions.push_back(std::move(lonBFunction)); + parameterFunctions.push_back(std::move(latBFunction)); + parameterFunctions.push_back(std::move(tsBFunction)); +} + +VarVal TemporalNePhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> bool { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({} {})@{}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({} {})@{}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return temporal_ne(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + } + catch (const std::exception&) + { + return 0; + } + }, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTemporalNePhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 6, + "TemporalNePhysicalFunction requires 6 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + auto arg3 = std::move(arguments.childFunctions[3]); + auto arg4 = std::move(arguments.childFunctions[4]); + auto arg5 = std::move(arguments.childFunctions[5]); + return TemporalNePhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2), std::move(arg3), std::move(arg4), std::move(arg5)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TfloatCeilPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TfloatCeilPhysicalFunction.cpp new file mode 100644 index 0000000000..6b71aa471c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TfloatCeilPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TfloatCeilPhysicalFunction::TfloatCeilPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TfloatCeilPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0.0; + + Temporal* res = tfloat_ceil(temp); + free(temp); + if (!res) return 0.0; + double r = tfloat_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTfloatCeilPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TfloatCeilPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TfloatCeilPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TfloatExpPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TfloatExpPhysicalFunction.cpp new file mode 100644 index 0000000000..c531b724e1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TfloatExpPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TfloatExpPhysicalFunction::TfloatExpPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TfloatExpPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0.0; + + Temporal* res = tfloat_exp(temp); + free(temp); + if (!res) return 0.0; + double r = tfloat_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTfloatExpPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TfloatExpPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TfloatExpPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TfloatFloorPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TfloatFloorPhysicalFunction.cpp new file mode 100644 index 0000000000..1ae0585080 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TfloatFloorPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TfloatFloorPhysicalFunction::TfloatFloorPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TfloatFloorPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0.0; + + Temporal* res = tfloat_floor(temp); + free(temp); + if (!res) return 0.0; + double r = tfloat_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTfloatFloorPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TfloatFloorPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TfloatFloorPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TfloatLnPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TfloatLnPhysicalFunction.cpp new file mode 100644 index 0000000000..06280a0083 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TfloatLnPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TfloatLnPhysicalFunction::TfloatLnPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TfloatLnPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0.0; + + Temporal* res = tfloat_ln(temp); + free(temp); + if (!res) return 0.0; + double r = tfloat_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTfloatLnPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TfloatLnPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TfloatLnPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TfloatLog10PhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TfloatLog10PhysicalFunction.cpp new file mode 100644 index 0000000000..550f333667 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TfloatLog10PhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TfloatLog10PhysicalFunction::TfloatLog10PhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TfloatLog10PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0.0; + + Temporal* res = tfloat_log10(temp); + free(temp); + if (!res) return 0.0; + double r = tfloat_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTfloatLog10PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TfloatLog10PhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TfloatLog10PhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TfloatRadiansPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TfloatRadiansPhysicalFunction.cpp new file mode 100644 index 0000000000..d5afc7a083 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TfloatRadiansPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TfloatRadiansPhysicalFunction::TfloatRadiansPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TfloatRadiansPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0.0; + + Temporal* res = tfloat_radians(temp); + free(temp); + if (!res) return 0.0; + double r = tfloat_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTfloatRadiansPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TfloatRadiansPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TfloatRadiansPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TfloatToTintPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TfloatToTintPhysicalFunction.cpp new file mode 100644 index 0000000000..d4ee0b491c --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TfloatToTintPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TfloatToTintPhysicalFunction::TfloatToTintPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TfloatToTintPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts) -> int { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0; + + Temporal* res = tfloat_to_tint(temp); + free(temp); + if (!res) return 0; + int r = tint_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTfloatToTintPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TfloatToTintPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TfloatToTintPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TintToTfloatPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TintToTfloatPhysicalFunction.cpp new file mode 100644 index 0000000000..49fe1fb891 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TintToTfloatPhysicalFunction.cpp @@ -0,0 +1,96 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TintToTfloatPhysicalFunction::TintToTfloatPhysicalFunction(PhysicalFunction valueFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(2); + parameterFunctions.push_back(std::move(valueFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TintToTfloatPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto value = parameterValues[0].cast>(); + auto ts = parameterValues[1].cast>(); + + const auto result = nautilus::invoke( + +[](double value, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempWkt = fmt::format("{}@{}", value, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tfloat_in(tempWkt.c_str()); + if (!temp) return 0.0; + + Temporal* res = tint_to_tfloat(temp); + free(temp); + if (!res) return 0.0; + double r = tfloat_start_value(res); + free(res); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + value, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTintToTfloatPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 2, + "TintToTfloatPhysicalFunction requires 2 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + return TintToTfloatPhysicalFunction(std::move(arg0), std::move(arg1)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TnpointLengthPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TnpointLengthPhysicalFunction.cpp new file mode 100644 index 0000000000..b07d8e1ca1 --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TnpointLengthPhysicalFunction.cpp @@ -0,0 +1,99 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TnpointLengthPhysicalFunction::TnpointLengthPhysicalFunction(PhysicalFunction ridFunction, + PhysicalFunction fracFunction, + PhysicalFunction tsFunction) +{ + parameterFunctions.reserve(3); + parameterFunctions.push_back(std::move(ridFunction)); + parameterFunctions.push_back(std::move(fracFunction)); + parameterFunctions.push_back(std::move(tsFunction)); +} + +VarVal TnpointLengthPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto rid = parameterValues[0].cast>(); + auto frac = parameterValues[1].cast>(); + auto ts = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[](int64_t rid, + double frac, + uint64_t ts) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + if (frac < 0.0 || frac > 1.0) return 0.0; + std::string tempWkt = fmt::format("NPoint({},{})@{}", rid, frac, MEOS::Meos::convertEpochToTimestamp(ts)); + Temporal* temp = tnpoint_in(tempWkt.c_str()); + if (!temp) return 0.0; + + double r = tnpoint_length(temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + rid, frac, ts); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTnpointLengthPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 3, + "TnpointLengthPhysicalFunction requires 3 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + auto arg1 = std::move(arguments.childFunctions[1]); + auto arg2 = std::move(arguments.childFunctions[2]); + return TnpointLengthPhysicalFunction(std::move(arg0), std::move(arg1), std::move(arg2)); +} + +} // namespace NES diff --git a/nes-physical-operators/src/Functions/Meos/TpointLengthWkbPhysicalFunction.cpp b/nes-physical-operators/src/Functions/Meos/TpointLengthWkbPhysicalFunction.cpp new file mode 100644 index 0000000000..5a4ed7623b --- /dev/null +++ b/nes-physical-operators/src/Functions/Meos/TpointLengthWkbPhysicalFunction.cpp @@ -0,0 +1,88 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} + +namespace NES { + +TpointLengthWkbPhysicalFunction::TpointLengthWkbPhysicalFunction(PhysicalFunction trajFunction) +{ + parameterFunctions.reserve(1); + parameterFunctions.push_back(std::move(trajFunction)); +} + +VarVal TpointLengthWkbPhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + { + parameterValues.emplace_back(function.execute(record, arena)); + } + + auto traj = parameterValues[0].cast(); + + const auto result = nautilus::invoke( + +[](const char* trajPtr, uint32_t trajSize) -> double { + try + { + MEOS::Meos::ensureMeosInitialized(); + std::string tempHex(trajPtr, trajSize); + Temporal* temp = temporal_from_hexwkb(tempHex.c_str()); + if (!temp) return 0.0; + + double r = tpoint_length(temp); + free(temp); + return r; + } + catch (const std::exception&) + { + return 0.0; + } + }, + traj.getContent(), traj.getContentSize()); + + return VarVal(result); +} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::RegisterTpointLengthWkbPhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{ + PRECONDITION(arguments.childFunctions.size() == 1, + "TpointLengthWkbPhysicalFunction requires 1 children but got {}", + arguments.childFunctions.size()); + auto arg0 = std::move(arguments.childFunctions[0]); + return TpointLengthWkbPhysicalFunction(std::move(arg0)); +} + +} // namespace NES diff --git a/nes-plugins/MEOS/MEOSWrapper.cpp b/nes-plugins/MEOS/MEOSWrapper.cpp index 63442d9fbc..66499972f8 100644 --- a/nes-plugins/MEOS/MEOSWrapper.cpp +++ b/nes-plugins/MEOS/MEOSWrapper.cpp @@ -31,53 +31,73 @@ namespace MEOS { - // Global MEOS initialization - static bool meos_initialized = false; + // MEOS initialization. + // + // MEOS is thread-safe: session_timezone, the timezone cache, and the PROJ / + // ways / GSL caches are MEOS_TLS (thread-local). That means meos_initialize() + // sets up the calling thread's state — so it must run ON EVERY THREAD that + // calls MEOS. The engine runs operator pipelines on a worker thread pool, so + // a single process-global init flag leaves those worker threads with a NULL + // session_timezone; the first text-timestamp serialization on such a thread + // (tstzspan_out/stbox_out -> timestamp_out -> localsub) then segfaults. The + // hex-WKB path encodes raw microseconds and never touches the timezone, which + // is why only the text-output operators crashed. Initialize per thread. + static thread_local bool meos_thread_initialized = false; + static bool meos_atexit_registered = false; // guarded by meos_init_mutex + static std::once_flag meos_env_once; // process-global env, once static std::mutex meos_init_mutex; static std::mutex meos_parse_mutex; static std::mutex meos_exec_mutex; static void cleanupMeos() { - if (meos_initialized) { - meos_finalize(); - meos_initialized = false; - } + // Frees the exiting thread's thread-local MEOS caches. + meos_finalize(); } - static void ensureMeosInitialized() { - std::lock_guard lk(meos_init_mutex); - if (!meos_initialized) { - // Ensure a sane timezone environment before initializing MEOS (uses PostgreSQL tzdb) - const char* tzEnv = std::getenv("TZ"); - if (!tzEnv || *tzEnv == '\0') { - setenv("TZ", "UTC", 1); - } - // PGTZ is used by the underlying PG timezone code; prefer same value as TZ - const char* pgtzEnv = std::getenv("PGTZ"); - if (!pgtzEnv || *pgtzEnv == '\0') { - const char* tzNow = std::getenv("TZ"); - setenv("PGTZ", tzNow ? tzNow : "UTC", 1); - } - // Provide a tz database directory if none is set and a common system path exists - const char* tzdirEnv = std::getenv("TZDIR"); - if (!tzdirEnv || *tzdirEnv == '\0') { - namespace fs = std::filesystem; - const char* candidates[] = {"/usr/share/zoneinfo", "/usr/lib/zoneinfo", "/usr/share/lib/zoneinfo"}; - for (const auto* cand : candidates) { - std::error_code ec; - if (fs::exists(cand, ec) && !ec) { - setenv("TZDIR", cand, 1); - break; - } + static void setupMeosEnv() { + // Process-global timezone environment for MEOS (PostgreSQL tzdb); runs once. + const char* tzEnv = std::getenv("TZ"); + if (!tzEnv || *tzEnv == '\0') { + setenv("TZ", "UTC", 1); + } + // PGTZ is used by the underlying PG timezone code; prefer same value as TZ + const char* pgtzEnv = std::getenv("PGTZ"); + if (!pgtzEnv || *pgtzEnv == '\0') { + const char* tzNow = std::getenv("TZ"); + setenv("PGTZ", tzNow ? tzNow : "UTC", 1); + } + // Provide a tz database directory if none is set and a common system path exists + const char* tzdirEnv = std::getenv("TZDIR"); + if (!tzdirEnv || *tzdirEnv == '\0') { + namespace fs = std::filesystem; + const char* candidates[] = {"/usr/share/zoneinfo", "/usr/lib/zoneinfo", "/usr/share/lib/zoneinfo"}; + for (const auto* cand : candidates) { + std::error_code ec; + if (fs::exists(cand, ec) && !ec) { + setenv("TZDIR", cand, 1); + break; } } - tzset(); + } + tzset(); + } - meos_initialize(); - meos_initialized = true; - // Register cleanup function to be called at program exit - std::atexit(cleanupMeos); + static void ensureMeosInitialized() { + if (meos_thread_initialized) { + return; + } + std::call_once(meos_env_once, setupMeosEnv); + { + // Serialize the per-thread meos_initialize() calls so the process-global + // initializations they perform (PROJ / GEOS / error handler) do not race. + std::lock_guard lk(meos_init_mutex); + meos_initialize(); // sets up THIS thread's thread-local timezone + caches + if (!meos_atexit_registered) { + std::atexit(cleanupMeos); + meos_atexit_registered = true; + } } + meos_thread_initialized = true; } Meos::Meos() { diff --git a/nes-query-optimizer/src/RewriteRules/LowerToPhysical/LowerToPhysicalWindowedAggregation.cpp b/nes-query-optimizer/src/RewriteRules/LowerToPhysical/LowerToPhysicalWindowedAggregation.cpp index c994b91a9d..1d22ca3d09 100644 --- a/nes-query-optimizer/src/RewriteRules/LowerToPhysical/LowerToPhysicalWindowedAggregation.cpp +++ b/nes-query-optimizer/src/RewriteRules/LowerToPhysical/LowerToPhysicalWindowedAggregation.cpp @@ -55,8 +55,128 @@ #include // Special-case lowering for TEMPORAL_SEQUENCE (multi-input) aggregation #include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace NES { @@ -160,6 +280,1665 @@ getAggregationPhysicalFunctions(const WindowedAggregationLogicalOperator& logica continue; } + // Custom lowering path for TEMPORAL_LENGTH: same three-input shape as TEMPORAL_SEQUENCE, + // returns a FLOAT64 (the spheroidal length of the per-(window, group) trajectory) instead of a VARSIZED WKB blob. + if (name == std::string_view("TemporalLength")) + { + auto tlDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(tlDescriptor != nullptr, "Expected TemporalLengthAggregationLogicalFunction for TemporalLength"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(tlDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(tlDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(tlDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", tlDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", tlDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", tlDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + + // Custom lowering path for PAIR_MEETING (Q5): four input fields (lon, lat, ts, vehicle_id); + // returns a VARSIZED string-encoded list of meeting pairs. + if (name == std::string_view("PairMeeting")) + { + auto pmDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(pmDescriptor != nullptr, "Expected PairMeetingAggregationLogicalFunction for PairMeeting"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(pmDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(pmDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(pmDescriptor->getTimestampField()); + auto vidPF = QueryCompilation::FunctionProvider::lowerFunction(pmDescriptor->getVehicleIdField()); + + Schema stateSchema; + stateSchema.addField("lon", pmDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", pmDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", pmDescriptor->getTimestampField().getDataType()); + stateSchema.addField("vehicle_id", pmDescriptor->getVehicleIdField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + vidPF, + pmDescriptor->getDMeetMetres(), + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + + // Custom lowering path for CROSS_DISTANCE (Q9): four input fields (lon, lat, ts, vehicle_id); + // returns a FLOAT64 (distance between VID_A and VID_B latest positions in the window). + if (name == std::string_view("CrossDistance")) + { + auto cdDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(cdDescriptor != nullptr, "Expected CrossDistanceAggregationLogicalFunction for CrossDistance"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(cdDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(cdDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(cdDescriptor->getTimestampField()); + auto vidPF = QueryCompilation::FunctionProvider::lowerFunction(cdDescriptor->getVehicleIdField()); + + Schema stateSchema; + stateSchema.addField("lon", cdDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", cdDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", cdDescriptor->getTimestampField().getDataType()); + stateSchema.addField("vehicle_id", cdDescriptor->getVehicleIdField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + vidPF, + cdDescriptor->getVidA(), + cdDescriptor->getVidB(), + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalNumInstants (optimizer lowering) */ + if (name == std::string_view("TemporalNumInstants")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalNumInstantsAggregationLogicalFunction for TemporalNumInstants"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalNumInstants (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalNumSequences (optimizer lowering) */ + if (name == std::string_view("TemporalNumSequences")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalNumSequencesAggregationLogicalFunction for TemporalNumSequences"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalNumSequences (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalNumTimestamps (optimizer lowering) */ + if (name == std::string_view("TemporalNumTimestamps")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalNumTimestampsAggregationLogicalFunction for TemporalNumTimestamps"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalNumTimestamps (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTFloatStartValue (optimizer lowering) */ + if (name == std::string_view("TemporalTFloatStartValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTFloatStartValueAggregationLogicalFunction for TemporalTFloatStartValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTFloatStartValue (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTFloatEndValue (optimizer lowering) */ + if (name == std::string_view("TemporalTFloatEndValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTFloatEndValueAggregationLogicalFunction for TemporalTFloatEndValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTFloatEndValue (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTFloatMinValue (optimizer lowering) */ + if (name == std::string_view("TemporalTFloatMinValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTFloatMinValueAggregationLogicalFunction for TemporalTFloatMinValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTFloatMinValue (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTFloatMaxValue (optimizer lowering) */ + if (name == std::string_view("TemporalTFloatMaxValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTFloatMaxValueAggregationLogicalFunction for TemporalTFloatMaxValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTFloatMaxValue (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTNumberIntegral (optimizer lowering) */ + if (name == std::string_view("TemporalTNumberIntegral")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTNumberIntegralAggregationLogicalFunction for TemporalTNumberIntegral"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTNumberIntegral (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTIntStartValue (optimizer lowering) */ + if (name == std::string_view("TemporalTIntStartValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTIntStartValueAggregationLogicalFunction for TemporalTIntStartValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTIntStartValue (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTIntEndValue (optimizer lowering) */ + if (name == std::string_view("TemporalTIntEndValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTIntEndValueAggregationLogicalFunction for TemporalTIntEndValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTIntEndValue (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTIntMinValue (optimizer lowering) */ + if (name == std::string_view("TemporalTIntMinValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTIntMinValueAggregationLogicalFunction for TemporalTIntMinValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTIntMinValue (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTIntMaxValue (optimizer lowering) */ + if (name == std::string_view("TemporalTIntMaxValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTIntMaxValueAggregationLogicalFunction for TemporalTIntMaxValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTIntMaxValue (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTFloatAvgValue (optimizer lowering) */ + if (name == std::string_view("TemporalTFloatAvgValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTFloatAvgValueAggregationLogicalFunction for TemporalTFloatAvgValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTFloatAvgValue (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTNumberTwAvg (optimizer lowering) */ + if (name == std::string_view("TemporalTNumberTwAvg")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTNumberTwAvgAggregationLogicalFunction for TemporalTNumberTwAvg"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTNumberTwAvg (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTIntAvgValue (optimizer lowering) */ + if (name == std::string_view("TemporalTIntAvgValue")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTIntAvgValueAggregationLogicalFunction for TemporalTIntAvgValue"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTIntAvgValue (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalStartTimestamp (optimizer lowering) */ + if (name == std::string_view("TemporalStartTimestamp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalStartTimestampAggregationLogicalFunction for TemporalStartTimestamp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalStartTimestamp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalEndTimestamp (optimizer lowering) */ + if (name == std::string_view("TemporalEndTimestamp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalEndTimestampAggregationLogicalFunction for TemporalEndTimestamp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalEndTimestamp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalLowerInc (optimizer lowering) */ + if (name == std::string_view("TemporalLowerInc")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalLowerIncAggregationLogicalFunction for TemporalLowerInc"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalLowerInc (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalUpperInc (optimizer lowering) */ + if (name == std::string_view("TemporalUpperInc")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalUpperIncAggregationLogicalFunction for TemporalUpperInc"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalUpperInc (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalTPointIsSimple (optimizer lowering) */ + if (name == std::string_view("TemporalTPointIsSimple")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalTPointIsSimpleAggregationLogicalFunction for TemporalTPointIsSimple"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalTPointIsSimple (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TspatialExtent (optimizer lowering) */ + if (name == std::string_view("TspatialExtent")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TspatialExtentAggregationLogicalFunction for TspatialExtent"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TspatialExtent (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TnumberExtent (optimizer lowering) */ + if (name == std::string_view("TnumberExtent")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TnumberExtentAggregationLogicalFunction for TnumberExtent"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TnumberExtent (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: FloatExtent (optimizer lowering) */ + if (name == std::string_view("FloatExtent")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected FloatExtentAggregationLogicalFunction for FloatExtent"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: FloatExtent (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: IntExtent (optimizer lowering) */ + if (name == std::string_view("IntExtent")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected IntExtentAggregationLogicalFunction for IntExtent"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: IntExtent (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: BigintExtent (optimizer lowering) */ + if (name == std::string_view("BigintExtent")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected BigintExtentAggregationLogicalFunction for BigintExtent"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: BigintExtent (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TimestamptzExtent (optimizer lowering) */ + if (name == std::string_view("TimestamptzExtent")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TimestamptzExtentAggregationLogicalFunction for TimestamptzExtent"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TimestamptzExtent (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: FloatUnion (optimizer lowering) */ + if (name == std::string_view("FloatUnion")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected FloatUnionAggregationLogicalFunction for FloatUnion"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: FloatUnion (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: IntUnion (optimizer lowering) */ + if (name == std::string_view("IntUnion")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected IntUnionAggregationLogicalFunction for IntUnion"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: IntUnion (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: BigintUnion (optimizer lowering) */ + if (name == std::string_view("BigintUnion")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected BigintUnionAggregationLogicalFunction for BigintUnion"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: BigintUnion (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TimestamptzUnion (optimizer lowering) */ + if (name == std::string_view("TimestamptzUnion")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TimestamptzUnionAggregationLogicalFunction for TimestamptzUnion"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TimestamptzUnion (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TrajectoryWkb (optimizer lowering) */ + if (name == std::string_view("TrajectoryWkb")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TrajectoryWkbAggregationLogicalFunction for TrajectoryWkb"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TrajectoryWkb (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TLENGTH_EXP (optimizer lowering) */ + if (name == std::string_view("TLengthExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TLengthExpAggregationLogicalFunction for TLENGTH_EXP"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TLENGTH_EXP (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TgeoCentroidExp (optimizer lowering) */ + if (name == std::string_view("TgeoCentroidExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TgeoCentroidExpAggregationLogicalFunction for TgeoCentroidExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TgeoCentroidExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TpointAzimuthExp (optimizer lowering) */ + if (name == std::string_view("TpointAzimuthExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TpointAzimuthExpAggregationLogicalFunction for TpointAzimuthExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TpointAzimuthExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TpointAngularDifferenceExp (optimizer lowering) */ + if (name == std::string_view("TpointAngularDifferenceExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TpointAngularDifferenceExpAggregationLogicalFunction for TpointAngularDifferenceExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TpointAngularDifferenceExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TgeompointToTgeometryExp (optimizer lowering) */ + if (name == std::string_view("TgeompointToTgeometryExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TgeompointToTgeometryExpAggregationLogicalFunction for TgeompointToTgeometryExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TgeompointToTgeometryExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalCopyExp (optimizer lowering) */ + if (name == std::string_view("TemporalCopyExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalCopyExpAggregationLogicalFunction for TemporalCopyExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalCopyExp (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TnumberAbsExp (optimizer lowering) */ + if (name == std::string_view("TnumberAbsExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TnumberAbsExpAggregationLogicalFunction for TnumberAbsExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TnumberAbsExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TnumberDeltaValueExp (optimizer lowering) */ + if (name == std::string_view("TnumberDeltaValueExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TnumberDeltaValueExpAggregationLogicalFunction for TnumberDeltaValueExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TnumberDeltaValueExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TnumberAngularDifferenceExp (optimizer lowering) */ + if (name == std::string_view("TnumberAngularDifferenceExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TnumberAngularDifferenceExpAggregationLogicalFunction for TnumberAngularDifferenceExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TnumberAngularDifferenceExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalDerivativeExp (optimizer lowering) */ + if (name == std::string_view("TemporalDerivativeExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalDerivativeExpAggregationLogicalFunction for TemporalDerivativeExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalDerivativeExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalAtMaxExp (optimizer lowering) */ + if (name == std::string_view("TemporalAtMaxExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalAtMaxExpAggregationLogicalFunction for TemporalAtMaxExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalAtMaxExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalAtMinExp (optimizer lowering) */ + if (name == std::string_view("TemporalAtMinExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalAtMinExpAggregationLogicalFunction for TemporalAtMinExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalAtMinExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalMinusMaxExp (optimizer lowering) */ + if (name == std::string_view("TemporalMinusMaxExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalMinusMaxExpAggregationLogicalFunction for TemporalMinusMaxExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalMinusMaxExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TemporalMinusMinExp (optimizer lowering) */ + if (name == std::string_view("TemporalMinusMinExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TemporalMinusMinExpAggregationLogicalFunction for TemporalMinusMinExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TemporalMinusMinExp (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TnpointCumulativeLengthExp (optimizer lowering) */ + if (name == std::string_view("TnpointCumulativeLengthExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TnpointCumulativeLengthExpAggregationLogicalFunction for TnpointCumulativeLengthExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TnpointCumulativeLengthExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TnpointSpeedExp (optimizer lowering) */ + if (name == std::string_view("TnpointSpeedExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TnpointSpeedExpAggregationLogicalFunction for TnpointSpeedExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TnpointSpeedExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TnpointToTgeompointExp (optimizer lowering) */ + if (name == std::string_view("TnpointToTgeompointExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TnpointToTgeompointExpAggregationLogicalFunction for TnpointToTgeompointExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TnpointToTgeompointExp (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TpointCumulativeLengthExp (optimizer lowering) */ + if (name == std::string_view("TpointCumulativeLengthExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TpointCumulativeLengthExpAggregationLogicalFunction for TpointCumulativeLengthExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TpointCumulativeLengthExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TpointSpeedExp (optimizer lowering) */ + if (name == std::string_view("TpointSpeedExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TpointSpeedExpAggregationLogicalFunction for TpointSpeedExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TpointSpeedExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TpointGetXExp (optimizer lowering) */ + if (name == std::string_view("TpointGetXExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TpointGetXExpAggregationLogicalFunction for TpointGetXExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TpointGetXExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TpointGetYExp (optimizer lowering) */ + if (name == std::string_view("TpointGetYExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TpointGetYExpAggregationLogicalFunction for TpointGetYExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TpointGetYExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TnumberTrendExp (optimizer lowering) */ + if (name == std::string_view("TnumberTrendExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TnumberTrendExpAggregationLogicalFunction for TnumberTrendExp"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TnumberTrendExp (optimizer lowering) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TgeoStartValueExp (optimizer lowering) */ + if (name == std::string_view("TgeoStartValueExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TgeoStartValueExpAggregationLogicalFunction for TgeoStartValueExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TgeoStartValueExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TgeoEndValueExp (optimizer lowering) */ + if (name == std::string_view("TgeoEndValueExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TgeoEndValueExpAggregationLogicalFunction for TgeoEndValueExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TgeoEndValueExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TgeoConvexHullExp (optimizer lowering) */ + if (name == std::string_view("TgeoConvexHullExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TgeoConvexHullExpAggregationLogicalFunction for TgeoConvexHullExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TgeoConvexHullExp (optimizer lowering) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TpointTwcentroidExp (optimizer lowering) */ + if (name == std::string_view("TpointTwcentroidExp")) + { + auto specificDescriptor = std::dynamic_pointer_cast(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected TpointTwcentroidExpAggregationLogicalFunction for TpointTwcentroidExp"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + } + /* END CODEGEN AGGREGATION GLUE: TpointTwcentroidExp (optimizer lowering) */ + + + + + + + + + + + + + + // Default path: use registry for single-input aggregations auto aggregationInputFunction = QueryCompilation::FunctionProvider::lowerFunction(descriptor->onField); auto aggregationArguments = AggregationPhysicalFunctionRegistryArguments( diff --git a/nes-sql-parser/AntlrSQL.g4 b/nes-sql-parser/AntlrSQL.g4 index 256726e087..3d40c20500 100644 --- a/nes-sql-parser/AntlrSQL.g4 +++ b/nes-sql-parser/AntlrSQL.g4 @@ -295,7 +295,7 @@ timeUnit: MS timestampParameter: name=identifier; -functionName: IDENTIFIER | AVG | MAX | MIN | SUM | COUNT | MEDIAN | ARRAY_AGG | VAR | TEMPORAL_SEQUENCE | TEMPORAL_EINTERSECTS_GEOMETRY | TEMPORAL_AINTERSECTS_GEOMETRY | TEMPORAL_ECONTAINS_GEOMETRY | EDWITHIN_TGEO_GEO | TGEO_AT_STBOX; +functionName: IDENTIFIER | AVG | MAX | MIN | SUM | COUNT | MEDIAN | ARRAY_AGG | VAR | TEMPORAL_SEQUENCE | TEMPORAL_LENGTH | PAIR_MEETING | CROSS_DISTANCE | TEMPORAL_EINTERSECTS_GEOMETRY | TEMPORAL_AINTERSECTS_GEOMETRY | TEMPORAL_ECONTAINS_GEOMETRY | EDWITHIN_TGEO_GEO | TGEO_AT_STBOX | TEMPORAL_ADISJOINT_GEOMETRY | TEMPORAL_ECONTAINS_TGEOMETRY | TEMPORAL_ECOVERS_TGEOMETRY | TEMPORAL_EDISJOINT_TGEOMETRY | TEMPORAL_EINTERSECTS_TGEOMETRY | TEMPORAL_ETOUCHES_TGEOMETRY | TEMPORAL_ACONTAINS_TGEOMETRY | TEMPORAL_ADISJOINT_TGEOMETRY | TEMPORAL_AINTERSECTS_TGEOMETRY | TEMPORAL_ATOUCHES_TGEOMETRY | TEMPORAL_NAD_GEOMETRY | TEMPORAL_NAD_TGEOMETRY | TEMPORAL_EDWITHIN_TGEOMETRY | TEMPORAL_ADWITHIN_GEOMETRY | TEMPORAL_ADWITHIN_TGEOMETRY | TEMPORAL_EDISJOINT_GEOMETRY | TEMPORAL_ATOUCHES_GEOMETRY | TEMPORAL_ECOVERS_GEOMETRY | TEMPORAL_ACONTAINS_GEOMETRY | TEMPORAL_ETOUCHES_GEOMETRY | TEMPORAL_NAD_FLOAT_SCALAR | TEMPORAL_NAD_INT_SCALAR | TEMPORAL_NAD_TFLOAT | TEMPORAL_NAD_TINT | TEMPORAL_AT_GEOMETRY | TEMPORAL_MINUS_GEOMETRY | TEMPORAL_NUM_INSTANTS | TEMPORAL_NUM_SEQUENCES | TEMPORAL_NUM_TIMESTAMPS | TEMPORAL_TFLOAT_START_VALUE | TEMPORAL_TFLOAT_END_VALUE | TEMPORAL_TFLOAT_MIN_VALUE | TEMPORAL_TFLOAT_MAX_VALUE | TEMPORAL_TNUMBER_INTEGRAL | TEMPORAL_TINT_START_VALUE | TEMPORAL_TINT_END_VALUE | TEMPORAL_TINT_MIN_VALUE | TEMPORAL_TINT_MAX_VALUE | TEMPORAL_TFLOAT_AVG_VALUE | TEMPORAL_TNUMBER_TWAVG | TEMPORAL_TINT_AVG_VALUE | TEMPORAL_START_TIMESTAMP | TEMPORAL_END_TIMESTAMP | TEMPORAL_LOWER_INC | TEMPORAL_UPPER_INC | TEMPORAL_TPOINT_IS_SIMPLE | TEMPORAL_ECONTAINS_TCBUFFER | TEMPORAL_ECOVERS_TCBUFFER | TEMPORAL_EDISJOINT_TCBUFFER | TEMPORAL_EINTERSECTS_TCBUFFER | TEMPORAL_ETOUCHES_TCBUFFER | TEMPORAL_ACONTAINS_TCBUFFER | TEMPORAL_ACOVERS_TCBUFFER | TEMPORAL_ADISJOINT_TCBUFFER | TEMPORAL_AINTERSECTS_TCBUFFER | TEMPORAL_ATOUCHES_TCBUFFER | TEMPORAL_ECONTAINS_TCBUFFER_CBUFFER | TEMPORAL_ECOVERS_TCBUFFER_CBUFFER | TEMPORAL_EDISJOINT_TCBUFFER_CBUFFER | TEMPORAL_EINTERSECTS_TCBUFFER_CBUFFER | TEMPORAL_ETOUCHES_TCBUFFER_CBUFFER | TEMPORAL_ACONTAINS_TCBUFFER_CBUFFER | TEMPORAL_ACOVERS_TCBUFFER_CBUFFER | TEMPORAL_ADISJOINT_TCBUFFER_CBUFFER | TEMPORAL_AINTERSECTS_TCBUFFER_CBUFFER | TEMPORAL_ATOUCHES_TCBUFFER_CBUFFER | TEMPORAL_ADISJOINT_TCBUFFER_TCBUFFER | TEMPORAL_AINTERSECTS_TCBUFFER_TCBUFFER | TEMPORAL_ATOUCHES_TCBUFFER_TCBUFFER | TEMPORAL_ECOVERS_TCBUFFER_TCBUFFER | TEMPORAL_EINTERSECTS_TCBUFFER_TCBUFFER | TEMPORAL_ETOUCHES_TCBUFFER_TCBUFFER | TEMPORAL_EDWITHIN_TCBUFFER_GEOMETRY | TEMPORAL_ADWITHIN_TCBUFFER_GEOMETRY | TEMPORAL_EDWITHIN_TCBUFFER_CBUFFER | TEMPORAL_ADWITHIN_TCBUFFER_CBUFFER | TEMPORAL_EDWITHIN_TCBUFFER_TCBUFFER | TEMPORAL_ADWITHIN_TCBUFFER_TCBUFFER | TEMPORAL_ECONTAINS_TPOSE_GEOMETRY | TEMPORAL_ECOVERS_TPOSE_GEOMETRY | TEMPORAL_EDISJOINT_TPOSE_GEOMETRY | TEMPORAL_EINTERSECTS_TPOSE_GEOMETRY | TEMPORAL_ETOUCHES_TPOSE_GEOMETRY | TEMPORAL_ACONTAINS_TPOSE_GEOMETRY | TEMPORAL_ADISJOINT_TPOSE_GEOMETRY | TEMPORAL_AINTERSECTS_TPOSE_GEOMETRY | TEMPORAL_ATOUCHES_TPOSE_GEOMETRY | TEMPORAL_ECONTAINS_TPOSE_TPOSE | TEMPORAL_ECOVERS_TPOSE_TPOSE | TEMPORAL_EDISJOINT_TPOSE_TPOSE | TEMPORAL_EINTERSECTS_TPOSE_TPOSE | TEMPORAL_ETOUCHES_TPOSE_TPOSE | TEMPORAL_ACONTAINS_TPOSE_TPOSE | TEMPORAL_ADISJOINT_TPOSE_TPOSE | TEMPORAL_AINTERSECTS_TPOSE_TPOSE | TEMPORAL_ATOUCHES_TPOSE_TPOSE | TEMPORAL_ECONTAINS_TNPOINT_GEOMETRY | TEMPORAL_ECONTAINS_TNPOINT_TNPOINT | TEMPORAL_ECOVERS_TNPOINT_GEOMETRY | TEMPORAL_ECOVERS_TNPOINT_TNPOINT | TEMPORAL_EDISJOINT_TNPOINT_GEOMETRY | TEMPORAL_EDISJOINT_TNPOINT_TNPOINT | TEMPORAL_EINTERSECTS_TNPOINT_GEOMETRY | TEMPORAL_EINTERSECTS_TNPOINT_TNPOINT | TEMPORAL_ETOUCHES_TNPOINT_GEOMETRY | TEMPORAL_ETOUCHES_TNPOINT_TNPOINT | TEMPORAL_ACONTAINS_TNPOINT_GEOMETRY | TEMPORAL_ACONTAINS_TNPOINT_TNPOINT | TEMPORAL_ADISJOINT_TNPOINT_GEOMETRY | TEMPORAL_ADISJOINT_TNPOINT_TNPOINT | TEMPORAL_AINTERSECTS_TNPOINT_GEOMETRY | TEMPORAL_AINTERSECTS_TNPOINT_TNPOINT | TEMPORAL_ATOUCHES_TNPOINT_GEOMETRY | TEMPORAL_ATOUCHES_TNPOINT_TNPOINT | TEMPORAL_NAD_TPOSE_GEOMETRY | TEMPORAL_NAD_TPOSE_TPOSE | TEMPORAL_NAD_TNPOINT_GEOMETRY | TEMPORAL_NAD_TNPOINT_TNPOINT | TEMPORAL_EDWITHIN_TPOSE_GEOMETRY | TEMPORAL_EDWITHIN_TPOSE_TPOSE | TEMPORAL_EDWITHIN_TNPOINT_GEOMETRY | TEMPORAL_EDWITHIN_TNPOINT_TNPOINT | TEMPORAL_ADWITHIN_TPOSE_GEOMETRY | TEMPORAL_ADWITHIN_TPOSE_TPOSE | TEMPORAL_ADWITHIN_TNPOINT_GEOMETRY | TEMPORAL_ADWITHIN_TNPOINT_TNPOINT | TEMPORAL_NAD_TCBUFFER | TEMPORAL_NAD_TCBUFFER_CBUFFER | TEMPORAL_NAD_TCBUFFER_TCBUFFER | ALWAYS_EQ_TFLOAT_FLOAT | ALWAYS_EQ_TINT_INT | ALWAYS_GE_TFLOAT_FLOAT | ALWAYS_GE_TINT_INT | ALWAYS_GT_TFLOAT_FLOAT | ALWAYS_GT_TINT_INT | ALWAYS_LE_TFLOAT_FLOAT | ALWAYS_LE_TINT_INT | ALWAYS_LT_TFLOAT_FLOAT | ALWAYS_LT_TINT_INT | ALWAYS_NE_TFLOAT_FLOAT | ALWAYS_NE_TINT_INT | EVER_EQ_TFLOAT_FLOAT | EVER_EQ_TINT_INT | EVER_GE_TFLOAT_FLOAT | EVER_GE_TINT_INT | EVER_GT_TFLOAT_FLOAT | EVER_GT_TINT_INT | EVER_LE_TFLOAT_FLOAT | EVER_LE_TINT_INT | EVER_LT_TFLOAT_FLOAT | EVER_LT_TINT_INT | EVER_NE_TFLOAT_FLOAT | EVER_NE_TINT_INT | ALWAYS_EQ_FLOAT_TFLOAT | ALWAYS_EQ_INT_TINT | ALWAYS_EQ_TEMPORAL_TEMPORAL | ALWAYS_GE_FLOAT_TFLOAT | ALWAYS_GE_INT_TINT | ALWAYS_GE_TEMPORAL_TEMPORAL | ALWAYS_GT_FLOAT_TFLOAT | ALWAYS_GT_INT_TINT | ALWAYS_GT_TEMPORAL_TEMPORAL | ALWAYS_LE_FLOAT_TFLOAT | ALWAYS_LE_INT_TINT | ALWAYS_LE_TEMPORAL_TEMPORAL | ALWAYS_LT_FLOAT_TFLOAT | ALWAYS_LT_INT_TINT | ALWAYS_LT_TEMPORAL_TEMPORAL | ALWAYS_NE_FLOAT_TFLOAT | ALWAYS_NE_INT_TINT | ALWAYS_NE_TEMPORAL_TEMPORAL | EVER_EQ_FLOAT_TFLOAT | EVER_EQ_INT_TINT | EVER_EQ_TEMPORAL_TEMPORAL | EVER_GE_FLOAT_TFLOAT | EVER_GE_INT_TINT | EVER_GE_TEMPORAL_TEMPORAL | EVER_GT_FLOAT_TFLOAT | EVER_GT_INT_TINT | EVER_GT_TEMPORAL_TEMPORAL | EVER_LE_FLOAT_TFLOAT | EVER_LE_INT_TINT | EVER_LE_TEMPORAL_TEMPORAL | EVER_LT_FLOAT_TFLOAT | EVER_LT_INT_TINT | EVER_LT_TEMPORAL_TEMPORAL | EVER_NE_FLOAT_TFLOAT | EVER_NE_INT_TINT | EVER_NE_TEMPORAL_TEMPORAL | ALWAYS_EQ_TCBUFFER_CBUFFER | ALWAYS_EQ_TCBUFFER_TCBUFFER | ALWAYS_EQ_TGEO_GEO | ALWAYS_EQ_TGEO_TGEO | ALWAYS_NE_TCBUFFER_CBUFFER | ALWAYS_NE_TCBUFFER_TCBUFFER | ALWAYS_NE_TGEO_GEO | ALWAYS_NE_TGEO_TGEO | ATOUCHES_TPOINT_GEO | ETOUCHES_TPOINT_GEO | EVER_EQ_TCBUFFER_CBUFFER | EVER_EQ_TCBUFFER_TCBUFFER | EVER_EQ_TGEO_GEO | EVER_EQ_TGEO_TGEO | EVER_NE_TCBUFFER_CBUFFER | EVER_NE_TCBUFFER_TCBUFFER | EVER_NE_TGEO_GEO | EVER_NE_TGEO_TGEO | ABOVE_TSPATIAL_TSPATIAL | ADJACENT_TEMPORAL_TEMPORAL | ADJACENT_TSPATIAL_TSPATIAL | AFTER_TEMPORAL_TEMPORAL | AFTER_TSPATIAL_TSPATIAL | ALWAYS_EQ_TBOOL_BOOL | ALWAYS_NE_TBOOL_BOOL | BACK_TSPATIAL_TSPATIAL | BEFORE_TEMPORAL_TEMPORAL | BEFORE_TSPATIAL_TSPATIAL | BELOW_TSPATIAL_TSPATIAL | CONTAINED_TEMPORAL_TEMPORAL | CONTAINED_TSPATIAL_TSPATIAL | CONTAINS_TEMPORAL_TEMPORAL | CONTAINS_TSPATIAL_TSPATIAL | EVER_EQ_TBOOL_BOOL | EVER_NE_TBOOL_BOOL | FRONT_TSPATIAL_TSPATIAL | LEFT_TSPATIAL_TSPATIAL | NAD_TNPOINT_GEO | NAD_TPOSE_GEO | OVERABOVE_TSPATIAL_TSPATIAL | OVERAFTER_TEMPORAL_TEMPORAL | OVERAFTER_TSPATIAL_TSPATIAL | OVERBACK_TSPATIAL_TSPATIAL | OVERBEFORE_TEMPORAL_TEMPORAL | OVERBEFORE_TSPATIAL_TSPATIAL | OVERBELOW_TSPATIAL_TSPATIAL | OVERFRONT_TSPATIAL_TSPATIAL | OVERLAPS_TEMPORAL_TEMPORAL | OVERLAPS_TSPATIAL_TSPATIAL | OVERLEFT_TSPATIAL_TSPATIAL | OVERRIGHT_TSPATIAL_TSPATIAL | RIGHT_TSPATIAL_TSPATIAL | SAME_TEMPORAL_TEMPORAL | SAME_TSPATIAL_TSPATIAL | TBOOL_END_VALUE | TBOOL_START_VALUE | TEMPORAL_CMP | TEMPORAL_DYNTIMEWARP_DISTANCE | TEMPORAL_EQ | TEMPORAL_FRECHET_DISTANCE | TEMPORAL_GE | TEMPORAL_GT | TEMPORAL_HAUSDORFF_DISTANCE | TEMPORAL_LE | TEMPORAL_LT | TEMPORAL_NE | TNPOINT_LENGTH | TBOOL_TO_TINT | TCBUFFER_TO_TFLOAT | TFLOAT_CEIL | TFLOAT_EXP | TFLOAT_FLOOR | TFLOAT_LN | TFLOAT_LOG10 | TFLOAT_RADIANS | TFLOAT_TO_TINT | TINT_TO_TFLOAT | ADJACENT_TNUMBER_TBOX | AFTER_TNUMBER_TBOX | BEFORE_TNUMBER_TBOX | CONTAINED_TNUMBER_TBOX | CONTAINS_TNUMBER_TBOX | LEFT_TNUMBER_TBOX | NAD_TCBUFFER_STBOX | NAD_TFLOAT_TBOX | NAD_TGEO_STBOX | NAD_TINT_TBOX | NAD_TNPOINT_STBOX | NAD_TPOSE_STBOX | OVERAFTER_TNUMBER_TBOX | OVERBEFORE_TNUMBER_TBOX | OVERLAPS_TNUMBER_TBOX | OVERLEFT_TNUMBER_TBOX | OVERRIGHT_TNUMBER_TBOX | RIGHT_TNUMBER_TBOX | SAME_TNUMBER_TBOX | TSPATIAL_EXTENT | TNUMBER_EXTENT | FLOAT_EXTENT | INT_EXTENT | BIGINT_EXTENT | TIMESTAMPTZ_EXTENT | ABOVE_STBOX_TSPATIAL | ABOVE_TSPATIAL_STBOX | ADJACENT_STBOX_TSPATIAL | ADJACENT_TBOX_TNUMBER | ADJACENT_TSPATIAL_STBOX | AFTER_STBOX_TSPATIAL | AFTER_TBOX_TNUMBER | AFTER_TSPATIAL_STBOX | BACK_STBOX_TSPATIAL | BACK_TSPATIAL_STBOX | BEFORE_STBOX_TSPATIAL | BEFORE_TBOX_TNUMBER | BEFORE_TSPATIAL_STBOX | BELOW_STBOX_TSPATIAL | BELOW_TSPATIAL_STBOX | CONTAINED_STBOX_TSPATIAL | CONTAINED_TBOX_TNUMBER | CONTAINED_TSPATIAL_STBOX | CONTAINS_STBOX_TSPATIAL | CONTAINS_TBOX_TNUMBER | CONTAINS_TSPATIAL_STBOX | FRONT_STBOX_TSPATIAL | FRONT_TSPATIAL_STBOX | LEFT_STBOX_TSPATIAL | LEFT_TBOX_TNUMBER | LEFT_TSPATIAL_STBOX | OVERABOVE_STBOX_TSPATIAL | OVERABOVE_TSPATIAL_STBOX | OVERAFTER_STBOX_TSPATIAL | OVERAFTER_TBOX_TNUMBER | OVERAFTER_TSPATIAL_STBOX | OVERBACK_STBOX_TSPATIAL | OVERBACK_TSPATIAL_STBOX | OVERBEFORE_STBOX_TSPATIAL | OVERBEFORE_TBOX_TNUMBER | OVERBEFORE_TSPATIAL_STBOX | OVERBELOW_STBOX_TSPATIAL | OVERBELOW_TSPATIAL_STBOX | OVERFRONT_STBOX_TSPATIAL | OVERFRONT_TSPATIAL_STBOX | OVERLAPS_STBOX_TSPATIAL | OVERLAPS_TBOX_TNUMBER | OVERLAPS_TSPATIAL_STBOX | OVERLEFT_STBOX_TSPATIAL | OVERLEFT_TBOX_TNUMBER | OVERLEFT_TSPATIAL_STBOX | OVERRIGHT_STBOX_TSPATIAL | OVERRIGHT_TBOX_TNUMBER | OVERRIGHT_TSPATIAL_STBOX | RIGHT_STBOX_TSPATIAL | RIGHT_TBOX_TNUMBER | RIGHT_TSPATIAL_STBOX | SAME_STBOX_TSPATIAL | SAME_TBOX_TNUMBER | SAME_TSPATIAL_STBOX | FLOAT_UNION | INT_UNION | BIGINT_UNION | TIMESTAMPTZ_UNION | TPOINT_LENGTH_WKB | TRAJECTORY_WKB | TLENGTH_EXP | TGEO_CENTROID_EXP | TPOINT_AZIMUTH_EXP | TPOINT_ANGULAR_DIFFERENCE_EXP | TGEOMPOINT_TO_TGEOMETRY_EXP | TEMPORAL_COPY_EXP | TNUMBER_ABS_EXP | TNUMBER_DELTA_VALUE_EXP | TNUMBER_ANGULAR_DIFFERENCE_EXP | TEMPORAL_DERIVATIVE_EXP | TEMPORAL_AT_MAX_EXP | TEMPORAL_AT_MIN_EXP | TEMPORAL_MINUS_MAX_EXP | TEMPORAL_MINUS_MIN_EXP | TNPOINT_CUMULATIVE_LENGTH_EXP | TNPOINT_SPEED_EXP | TNPOINT_TO_TGEOMPOINT_EXP | TPOINT_CUMULATIVE_LENGTH_EXP | TPOINT_SPEED_EXP | TPOINT_GET_X_EXP | TPOINT_GET_Y_EXP | TNUMBER_TREND_EXP | TGEO_START_VALUE_EXP | TGEO_END_VALUE_EXP | TGEO_CONVEX_HULL_EXP | TPOINT_TWCENTROID_EXP | ABOVE_STBOX_STBOX | ADJACENT_STBOX_STBOX | AFTER_STBOX_STBOX | BACK_STBOX_STBOX | BEFORE_STBOX_STBOX | BELOW_STBOX_STBOX | CONTAINED_STBOX_STBOX | CONTAINS_STBOX_STBOX | FRONT_STBOX_STBOX | LEFT_STBOX_STBOX | NAD_STBOX_STBOX | OVERABOVE_STBOX_STBOX | OVERAFTER_STBOX_STBOX | OVERBACK_STBOX_STBOX | OVERBEFORE_STBOX_STBOX | OVERBELOW_STBOX_STBOX | OVERFRONT_STBOX_STBOX | OVERLAPS_STBOX_STBOX | OVERLEFT_STBOX_STBOX | OVERRIGHT_STBOX_STBOX | RIGHT_STBOX_STBOX | SAME_STBOX_STBOX | STBOX_CMP | STBOX_EQ | STBOX_GE | STBOX_GT | STBOX_LE | STBOX_LT | STBOX_NE | ADJACENT_TNUMBER_TNUMBER | AFTER_TNUMBER_TNUMBER | BEFORE_TNUMBER_TNUMBER | CONTAINED_TNUMBER_TNUMBER | CONTAINS_TNUMBER_TNUMBER | LEFT_TNUMBER_TNUMBER | OVERAFTER_TNUMBER_TNUMBER | OVERBEFORE_TNUMBER_TNUMBER | OVERLAPS_TNUMBER_TNUMBER | OVERLEFT_TNUMBER_TNUMBER | OVERRIGHT_TNUMBER_TNUMBER | RIGHT_TNUMBER_TNUMBER | SAME_TNUMBER_TNUMBER; sinkClause: INTO sink (',' sink)*; @@ -483,11 +483,438 @@ MEDIAN: 'MEDIAN' | 'median'; VAR: 'VAR' | 'var'; ARRAY_AGG: 'ARRAY_AGG' | 'array_agg'; TEMPORAL_SEQUENCE: 'TEMPORAL_SEQUENCE' | 'temporal_sequence'; +TEMPORAL_LENGTH: 'TEMPORAL_LENGTH' | 'temporal_length'; +PAIR_MEETING: 'PAIR_MEETING' | 'pair_meeting'; +CROSS_DISTANCE: 'CROSS_DISTANCE' | 'cross_distance'; TEMPORAL_EINTERSECTS_GEOMETRY: 'TEMPORAL_EINTERSECTS_GEOMETRY' | 'temporal_eintersects_geometry'; TEMPORAL_AINTERSECTS_GEOMETRY: 'TEMPORAL_AINTERSECTS_GEOMETRY' | 'temporal_aintersects_geometry'; TEMPORAL_ECONTAINS_GEOMETRY: 'TEMPORAL_ECONTAINS_GEOMETRY' | 'temporal_econtains_geometry'; EDWITHIN_TGEO_GEO: 'EDWITHIN_TGEO_GEO' | 'edwithin_tgeo_geo'; TGEO_AT_STBOX: 'TGEO_AT_STBOX' | 'tgeo_at_stbox'; +/* BEGIN CODEGEN LEXER TOKENS */ +TEMPORAL_ADISJOINT_GEOMETRY: 'TEMPORAL_ADISJOINT_GEOMETRY' | 'temporal_adisjoint_geometry'; +TEMPORAL_ECONTAINS_TGEOMETRY: 'TEMPORAL_ECONTAINS_TGEOMETRY' | 'temporal_econtains_tgeometry'; +TEMPORAL_ECOVERS_TGEOMETRY: 'TEMPORAL_ECOVERS_TGEOMETRY' | 'temporal_ecovers_tgeometry'; +TEMPORAL_EDISJOINT_TGEOMETRY: 'TEMPORAL_EDISJOINT_TGEOMETRY' | 'temporal_edisjoint_tgeometry'; +TEMPORAL_EINTERSECTS_TGEOMETRY: 'TEMPORAL_EINTERSECTS_TGEOMETRY' | 'temporal_eintersects_tgeometry'; +TEMPORAL_ETOUCHES_TGEOMETRY: 'TEMPORAL_ETOUCHES_TGEOMETRY' | 'temporal_etouches_tgeometry'; +TEMPORAL_ACONTAINS_TGEOMETRY: 'TEMPORAL_ACONTAINS_TGEOMETRY' | 'temporal_acontains_tgeometry'; +TEMPORAL_ADISJOINT_TGEOMETRY: 'TEMPORAL_ADISJOINT_TGEOMETRY' | 'temporal_adisjoint_tgeometry'; +TEMPORAL_AINTERSECTS_TGEOMETRY: 'TEMPORAL_AINTERSECTS_TGEOMETRY' | 'temporal_aintersects_tgeometry'; +TEMPORAL_ATOUCHES_TGEOMETRY: 'TEMPORAL_ATOUCHES_TGEOMETRY' | 'temporal_atouches_tgeometry'; +TEMPORAL_NAD_GEOMETRY: 'TEMPORAL_NAD_GEOMETRY' | 'temporal_nad_geometry'; +TEMPORAL_NAD_TGEOMETRY: 'TEMPORAL_NAD_TGEOMETRY' | 'temporal_nad_tgeometry'; +TEMPORAL_EDWITHIN_TGEOMETRY: 'TEMPORAL_EDWITHIN_TGEOMETRY' | 'temporal_edwithin_tgeometry'; +TEMPORAL_ADWITHIN_GEOMETRY: 'TEMPORAL_ADWITHIN_GEOMETRY' | 'temporal_adwithin_geometry'; +TEMPORAL_ADWITHIN_TGEOMETRY: 'TEMPORAL_ADWITHIN_TGEOMETRY' | 'temporal_adwithin_tgeometry'; +TEMPORAL_EDISJOINT_GEOMETRY: 'TEMPORAL_EDISJOINT_GEOMETRY' | 'temporal_edisjoint_geometry'; +TEMPORAL_ATOUCHES_GEOMETRY: 'TEMPORAL_ATOUCHES_GEOMETRY' | 'temporal_atouches_geometry'; +TEMPORAL_ECOVERS_GEOMETRY: 'TEMPORAL_ECOVERS_GEOMETRY' | 'temporal_ecovers_geometry'; +TEMPORAL_ACONTAINS_GEOMETRY: 'TEMPORAL_ACONTAINS_GEOMETRY' | 'temporal_acontains_geometry'; +TEMPORAL_ETOUCHES_GEOMETRY: 'TEMPORAL_ETOUCHES_GEOMETRY' | 'temporal_etouches_geometry'; +TEMPORAL_NAD_FLOAT_SCALAR: 'TEMPORAL_NAD_FLOAT_SCALAR' | 'temporal_nad_float_scalar'; +TEMPORAL_NAD_INT_SCALAR: 'TEMPORAL_NAD_INT_SCALAR' | 'temporal_nad_int_scalar'; +TEMPORAL_NAD_TFLOAT: 'TEMPORAL_NAD_TFLOAT' | 'temporal_nad_tfloat'; +TEMPORAL_NAD_TINT: 'TEMPORAL_NAD_TINT' | 'temporal_nad_tint'; +TEMPORAL_AT_GEOMETRY: 'TEMPORAL_AT_GEOMETRY' | 'temporal_at_geometry'; +TEMPORAL_MINUS_GEOMETRY: 'TEMPORAL_MINUS_GEOMETRY' | 'temporal_minus_geometry'; +TEMPORAL_ECONTAINS_TCBUFFER: 'TEMPORAL_ECONTAINS_TCBUFFER' | 'temporal_econtains_tcbuffer'; +TEMPORAL_ECOVERS_TCBUFFER: 'TEMPORAL_ECOVERS_TCBUFFER' | 'temporal_ecovers_tcbuffer'; +TEMPORAL_EDISJOINT_TCBUFFER: 'TEMPORAL_EDISJOINT_TCBUFFER' | 'temporal_edisjoint_tcbuffer'; +TEMPORAL_EINTERSECTS_TCBUFFER: 'TEMPORAL_EINTERSECTS_TCBUFFER' | 'temporal_eintersects_tcbuffer'; +TEMPORAL_ETOUCHES_TCBUFFER: 'TEMPORAL_ETOUCHES_TCBUFFER' | 'temporal_etouches_tcbuffer'; +TEMPORAL_ACONTAINS_TCBUFFER: 'TEMPORAL_ACONTAINS_TCBUFFER' | 'temporal_acontains_tcbuffer'; +TEMPORAL_ACOVERS_TCBUFFER: 'TEMPORAL_ACOVERS_TCBUFFER' | 'temporal_acovers_tcbuffer'; +TEMPORAL_ADISJOINT_TCBUFFER: 'TEMPORAL_ADISJOINT_TCBUFFER' | 'temporal_adisjoint_tcbuffer'; +TEMPORAL_AINTERSECTS_TCBUFFER: 'TEMPORAL_AINTERSECTS_TCBUFFER' | 'temporal_aintersects_tcbuffer'; +TEMPORAL_ATOUCHES_TCBUFFER: 'TEMPORAL_ATOUCHES_TCBUFFER' | 'temporal_atouches_tcbuffer'; +TEMPORAL_ECONTAINS_TCBUFFER_CBUFFER: 'TEMPORAL_ECONTAINS_TCBUFFER_CBUFFER' | 'temporal_econtains_tcbuffer_cbuffer'; +TEMPORAL_ECOVERS_TCBUFFER_CBUFFER: 'TEMPORAL_ECOVERS_TCBUFFER_CBUFFER' | 'temporal_ecovers_tcbuffer_cbuffer'; +TEMPORAL_EDISJOINT_TCBUFFER_CBUFFER: 'TEMPORAL_EDISJOINT_TCBUFFER_CBUFFER' | 'temporal_edisjoint_tcbuffer_cbuffer'; +TEMPORAL_EINTERSECTS_TCBUFFER_CBUFFER: 'TEMPORAL_EINTERSECTS_TCBUFFER_CBUFFER' | 'temporal_eintersects_tcbuffer_cbuffer'; +TEMPORAL_ETOUCHES_TCBUFFER_CBUFFER: 'TEMPORAL_ETOUCHES_TCBUFFER_CBUFFER' | 'temporal_etouches_tcbuffer_cbuffer'; +TEMPORAL_ACONTAINS_TCBUFFER_CBUFFER: 'TEMPORAL_ACONTAINS_TCBUFFER_CBUFFER' | 'temporal_acontains_tcbuffer_cbuffer'; +TEMPORAL_ACOVERS_TCBUFFER_CBUFFER: 'TEMPORAL_ACOVERS_TCBUFFER_CBUFFER' | 'temporal_acovers_tcbuffer_cbuffer'; +TEMPORAL_ADISJOINT_TCBUFFER_CBUFFER: 'TEMPORAL_ADISJOINT_TCBUFFER_CBUFFER' | 'temporal_adisjoint_tcbuffer_cbuffer'; +TEMPORAL_AINTERSECTS_TCBUFFER_CBUFFER: 'TEMPORAL_AINTERSECTS_TCBUFFER_CBUFFER' | 'temporal_aintersects_tcbuffer_cbuffer'; +TEMPORAL_ATOUCHES_TCBUFFER_CBUFFER: 'TEMPORAL_ATOUCHES_TCBUFFER_CBUFFER' | 'temporal_atouches_tcbuffer_cbuffer'; +TEMPORAL_ADISJOINT_TCBUFFER_TCBUFFER: 'TEMPORAL_ADISJOINT_TCBUFFER_TCBUFFER' | 'temporal_adisjoint_tcbuffer_tcbuffer'; +TEMPORAL_AINTERSECTS_TCBUFFER_TCBUFFER: 'TEMPORAL_AINTERSECTS_TCBUFFER_TCBUFFER' | 'temporal_aintersects_tcbuffer_tcbuffer'; +TEMPORAL_ATOUCHES_TCBUFFER_TCBUFFER: 'TEMPORAL_ATOUCHES_TCBUFFER_TCBUFFER' | 'temporal_atouches_tcbuffer_tcbuffer'; +TEMPORAL_ECOVERS_TCBUFFER_TCBUFFER: 'TEMPORAL_ECOVERS_TCBUFFER_TCBUFFER' | 'temporal_ecovers_tcbuffer_tcbuffer'; +TEMPORAL_EINTERSECTS_TCBUFFER_TCBUFFER: 'TEMPORAL_EINTERSECTS_TCBUFFER_TCBUFFER' | 'temporal_eintersects_tcbuffer_tcbuffer'; +TEMPORAL_ETOUCHES_TCBUFFER_TCBUFFER: 'TEMPORAL_ETOUCHES_TCBUFFER_TCBUFFER' | 'temporal_etouches_tcbuffer_tcbuffer'; +TEMPORAL_EDWITHIN_TCBUFFER_GEOMETRY: 'TEMPORAL_EDWITHIN_TCBUFFER_GEOMETRY' | 'temporal_edwithin_tcbuffer_geometry'; +TEMPORAL_ADWITHIN_TCBUFFER_GEOMETRY: 'TEMPORAL_ADWITHIN_TCBUFFER_GEOMETRY' | 'temporal_adwithin_tcbuffer_geometry'; +TEMPORAL_EDWITHIN_TCBUFFER_CBUFFER: 'TEMPORAL_EDWITHIN_TCBUFFER_CBUFFER' | 'temporal_edwithin_tcbuffer_cbuffer'; +TEMPORAL_ADWITHIN_TCBUFFER_CBUFFER: 'TEMPORAL_ADWITHIN_TCBUFFER_CBUFFER' | 'temporal_adwithin_tcbuffer_cbuffer'; +TEMPORAL_EDWITHIN_TCBUFFER_TCBUFFER: 'TEMPORAL_EDWITHIN_TCBUFFER_TCBUFFER' | 'temporal_edwithin_tcbuffer_tcbuffer'; +TEMPORAL_ADWITHIN_TCBUFFER_TCBUFFER: 'TEMPORAL_ADWITHIN_TCBUFFER_TCBUFFER' | 'temporal_adwithin_tcbuffer_tcbuffer'; +TEMPORAL_ECONTAINS_TPOSE_GEOMETRY: 'TEMPORAL_ECONTAINS_TPOSE_GEOMETRY' | 'temporal_econtains_tpose_geometry'; +TEMPORAL_ECOVERS_TPOSE_GEOMETRY: 'TEMPORAL_ECOVERS_TPOSE_GEOMETRY' | 'temporal_ecovers_tpose_geometry'; +TEMPORAL_EDISJOINT_TPOSE_GEOMETRY: 'TEMPORAL_EDISJOINT_TPOSE_GEOMETRY' | 'temporal_edisjoint_tpose_geometry'; +TEMPORAL_EINTERSECTS_TPOSE_GEOMETRY: 'TEMPORAL_EINTERSECTS_TPOSE_GEOMETRY' | 'temporal_eintersects_tpose_geometry'; +TEMPORAL_ETOUCHES_TPOSE_GEOMETRY: 'TEMPORAL_ETOUCHES_TPOSE_GEOMETRY' | 'temporal_etouches_tpose_geometry'; +TEMPORAL_ACONTAINS_TPOSE_GEOMETRY: 'TEMPORAL_ACONTAINS_TPOSE_GEOMETRY' | 'temporal_acontains_tpose_geometry'; +TEMPORAL_ADISJOINT_TPOSE_GEOMETRY: 'TEMPORAL_ADISJOINT_TPOSE_GEOMETRY' | 'temporal_adisjoint_tpose_geometry'; +TEMPORAL_AINTERSECTS_TPOSE_GEOMETRY: 'TEMPORAL_AINTERSECTS_TPOSE_GEOMETRY' | 'temporal_aintersects_tpose_geometry'; +TEMPORAL_ATOUCHES_TPOSE_GEOMETRY: 'TEMPORAL_ATOUCHES_TPOSE_GEOMETRY' | 'temporal_atouches_tpose_geometry'; +TEMPORAL_ECONTAINS_TPOSE_TPOSE: 'TEMPORAL_ECONTAINS_TPOSE_TPOSE' | 'temporal_econtains_tpose_tpose'; +TEMPORAL_ECOVERS_TPOSE_TPOSE: 'TEMPORAL_ECOVERS_TPOSE_TPOSE' | 'temporal_ecovers_tpose_tpose'; +TEMPORAL_EDISJOINT_TPOSE_TPOSE: 'TEMPORAL_EDISJOINT_TPOSE_TPOSE' | 'temporal_edisjoint_tpose_tpose'; +TEMPORAL_EINTERSECTS_TPOSE_TPOSE: 'TEMPORAL_EINTERSECTS_TPOSE_TPOSE' | 'temporal_eintersects_tpose_tpose'; +TEMPORAL_ETOUCHES_TPOSE_TPOSE: 'TEMPORAL_ETOUCHES_TPOSE_TPOSE' | 'temporal_etouches_tpose_tpose'; +TEMPORAL_ACONTAINS_TPOSE_TPOSE: 'TEMPORAL_ACONTAINS_TPOSE_TPOSE' | 'temporal_acontains_tpose_tpose'; +TEMPORAL_ADISJOINT_TPOSE_TPOSE: 'TEMPORAL_ADISJOINT_TPOSE_TPOSE' | 'temporal_adisjoint_tpose_tpose'; +TEMPORAL_AINTERSECTS_TPOSE_TPOSE: 'TEMPORAL_AINTERSECTS_TPOSE_TPOSE' | 'temporal_aintersects_tpose_tpose'; +TEMPORAL_ATOUCHES_TPOSE_TPOSE: 'TEMPORAL_ATOUCHES_TPOSE_TPOSE' | 'temporal_atouches_tpose_tpose'; +TEMPORAL_ECONTAINS_TNPOINT_GEOMETRY: 'TEMPORAL_ECONTAINS_TNPOINT_GEOMETRY' | 'temporal_econtains_tnpoint_geometry'; +TEMPORAL_ECONTAINS_TNPOINT_TNPOINT: 'TEMPORAL_ECONTAINS_TNPOINT_TNPOINT' | 'temporal_econtains_tnpoint_tnpoint'; +TEMPORAL_ECOVERS_TNPOINT_GEOMETRY: 'TEMPORAL_ECOVERS_TNPOINT_GEOMETRY' | 'temporal_ecovers_tnpoint_geometry'; +TEMPORAL_ECOVERS_TNPOINT_TNPOINT: 'TEMPORAL_ECOVERS_TNPOINT_TNPOINT' | 'temporal_ecovers_tnpoint_tnpoint'; +TEMPORAL_EDISJOINT_TNPOINT_GEOMETRY: 'TEMPORAL_EDISJOINT_TNPOINT_GEOMETRY' | 'temporal_edisjoint_tnpoint_geometry'; +TEMPORAL_EDISJOINT_TNPOINT_TNPOINT: 'TEMPORAL_EDISJOINT_TNPOINT_TNPOINT' | 'temporal_edisjoint_tnpoint_tnpoint'; +TEMPORAL_EINTERSECTS_TNPOINT_GEOMETRY: 'TEMPORAL_EINTERSECTS_TNPOINT_GEOMETRY' | 'temporal_eintersects_tnpoint_geometry'; +TEMPORAL_EINTERSECTS_TNPOINT_TNPOINT: 'TEMPORAL_EINTERSECTS_TNPOINT_TNPOINT' | 'temporal_eintersects_tnpoint_tnpoint'; +TEMPORAL_ETOUCHES_TNPOINT_GEOMETRY: 'TEMPORAL_ETOUCHES_TNPOINT_GEOMETRY' | 'temporal_etouches_tnpoint_geometry'; +TEMPORAL_ETOUCHES_TNPOINT_TNPOINT: 'TEMPORAL_ETOUCHES_TNPOINT_TNPOINT' | 'temporal_etouches_tnpoint_tnpoint'; +TEMPORAL_ACONTAINS_TNPOINT_GEOMETRY: 'TEMPORAL_ACONTAINS_TNPOINT_GEOMETRY' | 'temporal_acontains_tnpoint_geometry'; +TEMPORAL_ACONTAINS_TNPOINT_TNPOINT: 'TEMPORAL_ACONTAINS_TNPOINT_TNPOINT' | 'temporal_acontains_tnpoint_tnpoint'; +TEMPORAL_ADISJOINT_TNPOINT_GEOMETRY: 'TEMPORAL_ADISJOINT_TNPOINT_GEOMETRY' | 'temporal_adisjoint_tnpoint_geometry'; +TEMPORAL_ADISJOINT_TNPOINT_TNPOINT: 'TEMPORAL_ADISJOINT_TNPOINT_TNPOINT' | 'temporal_adisjoint_tnpoint_tnpoint'; +TEMPORAL_AINTERSECTS_TNPOINT_GEOMETRY: 'TEMPORAL_AINTERSECTS_TNPOINT_GEOMETRY' | 'temporal_aintersects_tnpoint_geometry'; +TEMPORAL_AINTERSECTS_TNPOINT_TNPOINT: 'TEMPORAL_AINTERSECTS_TNPOINT_TNPOINT' | 'temporal_aintersects_tnpoint_tnpoint'; +TEMPORAL_ATOUCHES_TNPOINT_GEOMETRY: 'TEMPORAL_ATOUCHES_TNPOINT_GEOMETRY' | 'temporal_atouches_tnpoint_geometry'; +TEMPORAL_ATOUCHES_TNPOINT_TNPOINT: 'TEMPORAL_ATOUCHES_TNPOINT_TNPOINT' | 'temporal_atouches_tnpoint_tnpoint'; +TEMPORAL_NAD_TPOSE_GEOMETRY: 'TEMPORAL_NAD_TPOSE_GEOMETRY' | 'temporal_nad_tpose_geometry'; +TEMPORAL_NAD_TPOSE_TPOSE: 'TEMPORAL_NAD_TPOSE_TPOSE' | 'temporal_nad_tpose_tpose'; +TEMPORAL_NAD_TNPOINT_GEOMETRY: 'TEMPORAL_NAD_TNPOINT_GEOMETRY' | 'temporal_nad_tnpoint_geometry'; +TEMPORAL_NAD_TNPOINT_TNPOINT: 'TEMPORAL_NAD_TNPOINT_TNPOINT' | 'temporal_nad_tnpoint_tnpoint'; +TEMPORAL_EDWITHIN_TPOSE_GEOMETRY: 'TEMPORAL_EDWITHIN_TPOSE_GEOMETRY' | 'temporal_edwithin_tpose_geometry'; +TEMPORAL_EDWITHIN_TPOSE_TPOSE: 'TEMPORAL_EDWITHIN_TPOSE_TPOSE' | 'temporal_edwithin_tpose_tpose'; +TEMPORAL_EDWITHIN_TNPOINT_GEOMETRY: 'TEMPORAL_EDWITHIN_TNPOINT_GEOMETRY' | 'temporal_edwithin_tnpoint_geometry'; +TEMPORAL_EDWITHIN_TNPOINT_TNPOINT: 'TEMPORAL_EDWITHIN_TNPOINT_TNPOINT' | 'temporal_edwithin_tnpoint_tnpoint'; +TEMPORAL_ADWITHIN_TPOSE_GEOMETRY: 'TEMPORAL_ADWITHIN_TPOSE_GEOMETRY' | 'temporal_adwithin_tpose_geometry'; +TEMPORAL_ADWITHIN_TPOSE_TPOSE: 'TEMPORAL_ADWITHIN_TPOSE_TPOSE' | 'temporal_adwithin_tpose_tpose'; +TEMPORAL_ADWITHIN_TNPOINT_GEOMETRY: 'TEMPORAL_ADWITHIN_TNPOINT_GEOMETRY' | 'temporal_adwithin_tnpoint_geometry'; +TEMPORAL_ADWITHIN_TNPOINT_TNPOINT: 'TEMPORAL_ADWITHIN_TNPOINT_TNPOINT' | 'temporal_adwithin_tnpoint_tnpoint'; +TEMPORAL_NAD_TCBUFFER: 'TEMPORAL_NAD_TCBUFFER' | 'temporal_nad_tcbuffer'; +TEMPORAL_NAD_TCBUFFER_CBUFFER: 'TEMPORAL_NAD_TCBUFFER_CBUFFER' | 'temporal_nad_tcbuffer_cbuffer'; +TEMPORAL_NAD_TCBUFFER_TCBUFFER: 'TEMPORAL_NAD_TCBUFFER_TCBUFFER' | 'temporal_nad_tcbuffer_tcbuffer'; +ALWAYS_EQ_TFLOAT_FLOAT: 'ALWAYS_EQ_TFLOAT_FLOAT' | 'always_eq_tfloat_float'; +ALWAYS_EQ_TINT_INT: 'ALWAYS_EQ_TINT_INT' | 'always_eq_tint_int'; +ALWAYS_GE_TFLOAT_FLOAT: 'ALWAYS_GE_TFLOAT_FLOAT' | 'always_ge_tfloat_float'; +ALWAYS_GE_TINT_INT: 'ALWAYS_GE_TINT_INT' | 'always_ge_tint_int'; +ALWAYS_GT_TFLOAT_FLOAT: 'ALWAYS_GT_TFLOAT_FLOAT' | 'always_gt_tfloat_float'; +ALWAYS_GT_TINT_INT: 'ALWAYS_GT_TINT_INT' | 'always_gt_tint_int'; +ALWAYS_LE_TFLOAT_FLOAT: 'ALWAYS_LE_TFLOAT_FLOAT' | 'always_le_tfloat_float'; +ALWAYS_LE_TINT_INT: 'ALWAYS_LE_TINT_INT' | 'always_le_tint_int'; +ALWAYS_LT_TFLOAT_FLOAT: 'ALWAYS_LT_TFLOAT_FLOAT' | 'always_lt_tfloat_float'; +ALWAYS_LT_TINT_INT: 'ALWAYS_LT_TINT_INT' | 'always_lt_tint_int'; +ALWAYS_NE_TFLOAT_FLOAT: 'ALWAYS_NE_TFLOAT_FLOAT' | 'always_ne_tfloat_float'; +ALWAYS_NE_TINT_INT: 'ALWAYS_NE_TINT_INT' | 'always_ne_tint_int'; +EVER_EQ_TFLOAT_FLOAT: 'EVER_EQ_TFLOAT_FLOAT' | 'ever_eq_tfloat_float'; +EVER_EQ_TINT_INT: 'EVER_EQ_TINT_INT' | 'ever_eq_tint_int'; +EVER_GE_TFLOAT_FLOAT: 'EVER_GE_TFLOAT_FLOAT' | 'ever_ge_tfloat_float'; +EVER_GE_TINT_INT: 'EVER_GE_TINT_INT' | 'ever_ge_tint_int'; +EVER_GT_TFLOAT_FLOAT: 'EVER_GT_TFLOAT_FLOAT' | 'ever_gt_tfloat_float'; +EVER_GT_TINT_INT: 'EVER_GT_TINT_INT' | 'ever_gt_tint_int'; +EVER_LE_TFLOAT_FLOAT: 'EVER_LE_TFLOAT_FLOAT' | 'ever_le_tfloat_float'; +EVER_LE_TINT_INT: 'EVER_LE_TINT_INT' | 'ever_le_tint_int'; +EVER_LT_TFLOAT_FLOAT: 'EVER_LT_TFLOAT_FLOAT' | 'ever_lt_tfloat_float'; +EVER_LT_TINT_INT: 'EVER_LT_TINT_INT' | 'ever_lt_tint_int'; +EVER_NE_TFLOAT_FLOAT: 'EVER_NE_TFLOAT_FLOAT' | 'ever_ne_tfloat_float'; +EVER_NE_TINT_INT: 'EVER_NE_TINT_INT' | 'ever_ne_tint_int'; +ALWAYS_EQ_FLOAT_TFLOAT: 'ALWAYS_EQ_FLOAT_TFLOAT' | 'always_eq_float_tfloat'; +ALWAYS_EQ_INT_TINT: 'ALWAYS_EQ_INT_TINT' | 'always_eq_int_tint'; +ALWAYS_EQ_TEMPORAL_TEMPORAL: 'ALWAYS_EQ_TEMPORAL_TEMPORAL' | 'always_eq_temporal_temporal'; +ALWAYS_GE_FLOAT_TFLOAT: 'ALWAYS_GE_FLOAT_TFLOAT' | 'always_ge_float_tfloat'; +ALWAYS_GE_INT_TINT: 'ALWAYS_GE_INT_TINT' | 'always_ge_int_tint'; +ALWAYS_GE_TEMPORAL_TEMPORAL: 'ALWAYS_GE_TEMPORAL_TEMPORAL' | 'always_ge_temporal_temporal'; +ALWAYS_GT_FLOAT_TFLOAT: 'ALWAYS_GT_FLOAT_TFLOAT' | 'always_gt_float_tfloat'; +ALWAYS_GT_INT_TINT: 'ALWAYS_GT_INT_TINT' | 'always_gt_int_tint'; +ALWAYS_GT_TEMPORAL_TEMPORAL: 'ALWAYS_GT_TEMPORAL_TEMPORAL' | 'always_gt_temporal_temporal'; +ALWAYS_LE_FLOAT_TFLOAT: 'ALWAYS_LE_FLOAT_TFLOAT' | 'always_le_float_tfloat'; +ALWAYS_LE_INT_TINT: 'ALWAYS_LE_INT_TINT' | 'always_le_int_tint'; +ALWAYS_LE_TEMPORAL_TEMPORAL: 'ALWAYS_LE_TEMPORAL_TEMPORAL' | 'always_le_temporal_temporal'; +ALWAYS_LT_FLOAT_TFLOAT: 'ALWAYS_LT_FLOAT_TFLOAT' | 'always_lt_float_tfloat'; +ALWAYS_LT_INT_TINT: 'ALWAYS_LT_INT_TINT' | 'always_lt_int_tint'; +ALWAYS_LT_TEMPORAL_TEMPORAL: 'ALWAYS_LT_TEMPORAL_TEMPORAL' | 'always_lt_temporal_temporal'; +ALWAYS_NE_FLOAT_TFLOAT: 'ALWAYS_NE_FLOAT_TFLOAT' | 'always_ne_float_tfloat'; +ALWAYS_NE_INT_TINT: 'ALWAYS_NE_INT_TINT' | 'always_ne_int_tint'; +ALWAYS_NE_TEMPORAL_TEMPORAL: 'ALWAYS_NE_TEMPORAL_TEMPORAL' | 'always_ne_temporal_temporal'; +EVER_EQ_FLOAT_TFLOAT: 'EVER_EQ_FLOAT_TFLOAT' | 'ever_eq_float_tfloat'; +EVER_EQ_INT_TINT: 'EVER_EQ_INT_TINT' | 'ever_eq_int_tint'; +EVER_EQ_TEMPORAL_TEMPORAL: 'EVER_EQ_TEMPORAL_TEMPORAL' | 'ever_eq_temporal_temporal'; +EVER_GE_FLOAT_TFLOAT: 'EVER_GE_FLOAT_TFLOAT' | 'ever_ge_float_tfloat'; +EVER_GE_INT_TINT: 'EVER_GE_INT_TINT' | 'ever_ge_int_tint'; +EVER_GE_TEMPORAL_TEMPORAL: 'EVER_GE_TEMPORAL_TEMPORAL' | 'ever_ge_temporal_temporal'; +EVER_GT_FLOAT_TFLOAT: 'EVER_GT_FLOAT_TFLOAT' | 'ever_gt_float_tfloat'; +EVER_GT_INT_TINT: 'EVER_GT_INT_TINT' | 'ever_gt_int_tint'; +EVER_GT_TEMPORAL_TEMPORAL: 'EVER_GT_TEMPORAL_TEMPORAL' | 'ever_gt_temporal_temporal'; +EVER_LE_FLOAT_TFLOAT: 'EVER_LE_FLOAT_TFLOAT' | 'ever_le_float_tfloat'; +EVER_LE_INT_TINT: 'EVER_LE_INT_TINT' | 'ever_le_int_tint'; +EVER_LE_TEMPORAL_TEMPORAL: 'EVER_LE_TEMPORAL_TEMPORAL' | 'ever_le_temporal_temporal'; +EVER_LT_FLOAT_TFLOAT: 'EVER_LT_FLOAT_TFLOAT' | 'ever_lt_float_tfloat'; +EVER_LT_INT_TINT: 'EVER_LT_INT_TINT' | 'ever_lt_int_tint'; +EVER_LT_TEMPORAL_TEMPORAL: 'EVER_LT_TEMPORAL_TEMPORAL' | 'ever_lt_temporal_temporal'; +EVER_NE_FLOAT_TFLOAT: 'EVER_NE_FLOAT_TFLOAT' | 'ever_ne_float_tfloat'; +EVER_NE_INT_TINT: 'EVER_NE_INT_TINT' | 'ever_ne_int_tint'; +EVER_NE_TEMPORAL_TEMPORAL: 'EVER_NE_TEMPORAL_TEMPORAL' | 'ever_ne_temporal_temporal'; +ALWAYS_EQ_TCBUFFER_CBUFFER: 'ALWAYS_EQ_TCBUFFER_CBUFFER' | 'always_eq_tcbuffer_cbuffer'; +ALWAYS_EQ_TCBUFFER_TCBUFFER: 'ALWAYS_EQ_TCBUFFER_TCBUFFER' | 'always_eq_tcbuffer_tcbuffer'; +ALWAYS_EQ_TGEO_GEO: 'ALWAYS_EQ_TGEO_GEO' | 'always_eq_tgeo_geo'; +ALWAYS_EQ_TGEO_TGEO: 'ALWAYS_EQ_TGEO_TGEO' | 'always_eq_tgeo_tgeo'; +ALWAYS_NE_TCBUFFER_CBUFFER: 'ALWAYS_NE_TCBUFFER_CBUFFER' | 'always_ne_tcbuffer_cbuffer'; +ALWAYS_NE_TCBUFFER_TCBUFFER: 'ALWAYS_NE_TCBUFFER_TCBUFFER' | 'always_ne_tcbuffer_tcbuffer'; +ALWAYS_NE_TGEO_GEO: 'ALWAYS_NE_TGEO_GEO' | 'always_ne_tgeo_geo'; +ALWAYS_NE_TGEO_TGEO: 'ALWAYS_NE_TGEO_TGEO' | 'always_ne_tgeo_tgeo'; +ATOUCHES_TPOINT_GEO: 'ATOUCHES_TPOINT_GEO' | 'atouches_tpoint_geo'; +ETOUCHES_TPOINT_GEO: 'ETOUCHES_TPOINT_GEO' | 'etouches_tpoint_geo'; +EVER_EQ_TCBUFFER_CBUFFER: 'EVER_EQ_TCBUFFER_CBUFFER' | 'ever_eq_tcbuffer_cbuffer'; +EVER_EQ_TCBUFFER_TCBUFFER: 'EVER_EQ_TCBUFFER_TCBUFFER' | 'ever_eq_tcbuffer_tcbuffer'; +EVER_EQ_TGEO_GEO: 'EVER_EQ_TGEO_GEO' | 'ever_eq_tgeo_geo'; +EVER_EQ_TGEO_TGEO: 'EVER_EQ_TGEO_TGEO' | 'ever_eq_tgeo_tgeo'; +EVER_NE_TCBUFFER_CBUFFER: 'EVER_NE_TCBUFFER_CBUFFER' | 'ever_ne_tcbuffer_cbuffer'; +EVER_NE_TCBUFFER_TCBUFFER: 'EVER_NE_TCBUFFER_TCBUFFER' | 'ever_ne_tcbuffer_tcbuffer'; +EVER_NE_TGEO_GEO: 'EVER_NE_TGEO_GEO' | 'ever_ne_tgeo_geo'; +EVER_NE_TGEO_TGEO: 'EVER_NE_TGEO_TGEO' | 'ever_ne_tgeo_tgeo'; +ABOVE_TSPATIAL_TSPATIAL: 'ABOVE_TSPATIAL_TSPATIAL' | 'above_tspatial_tspatial'; +ADJACENT_TEMPORAL_TEMPORAL: 'ADJACENT_TEMPORAL_TEMPORAL' | 'adjacent_temporal_temporal'; +ADJACENT_TSPATIAL_TSPATIAL: 'ADJACENT_TSPATIAL_TSPATIAL' | 'adjacent_tspatial_tspatial'; +AFTER_TEMPORAL_TEMPORAL: 'AFTER_TEMPORAL_TEMPORAL' | 'after_temporal_temporal'; +AFTER_TSPATIAL_TSPATIAL: 'AFTER_TSPATIAL_TSPATIAL' | 'after_tspatial_tspatial'; +ALWAYS_EQ_TBOOL_BOOL: 'ALWAYS_EQ_TBOOL_BOOL' | 'always_eq_tbool_bool'; +ALWAYS_NE_TBOOL_BOOL: 'ALWAYS_NE_TBOOL_BOOL' | 'always_ne_tbool_bool'; +BACK_TSPATIAL_TSPATIAL: 'BACK_TSPATIAL_TSPATIAL' | 'back_tspatial_tspatial'; +BEFORE_TEMPORAL_TEMPORAL: 'BEFORE_TEMPORAL_TEMPORAL' | 'before_temporal_temporal'; +BEFORE_TSPATIAL_TSPATIAL: 'BEFORE_TSPATIAL_TSPATIAL' | 'before_tspatial_tspatial'; +BELOW_TSPATIAL_TSPATIAL: 'BELOW_TSPATIAL_TSPATIAL' | 'below_tspatial_tspatial'; +CONTAINED_TEMPORAL_TEMPORAL: 'CONTAINED_TEMPORAL_TEMPORAL' | 'contained_temporal_temporal'; +CONTAINED_TSPATIAL_TSPATIAL: 'CONTAINED_TSPATIAL_TSPATIAL' | 'contained_tspatial_tspatial'; +CONTAINS_TEMPORAL_TEMPORAL: 'CONTAINS_TEMPORAL_TEMPORAL' | 'contains_temporal_temporal'; +CONTAINS_TSPATIAL_TSPATIAL: 'CONTAINS_TSPATIAL_TSPATIAL' | 'contains_tspatial_tspatial'; +EVER_EQ_TBOOL_BOOL: 'EVER_EQ_TBOOL_BOOL' | 'ever_eq_tbool_bool'; +EVER_NE_TBOOL_BOOL: 'EVER_NE_TBOOL_BOOL' | 'ever_ne_tbool_bool'; +FRONT_TSPATIAL_TSPATIAL: 'FRONT_TSPATIAL_TSPATIAL' | 'front_tspatial_tspatial'; +LEFT_TSPATIAL_TSPATIAL: 'LEFT_TSPATIAL_TSPATIAL' | 'left_tspatial_tspatial'; +NAD_TNPOINT_GEO: 'NAD_TNPOINT_GEO' | 'nad_tnpoint_geo'; +NAD_TPOSE_GEO: 'NAD_TPOSE_GEO' | 'nad_tpose_geo'; +OVERABOVE_TSPATIAL_TSPATIAL: 'OVERABOVE_TSPATIAL_TSPATIAL' | 'overabove_tspatial_tspatial'; +OVERAFTER_TEMPORAL_TEMPORAL: 'OVERAFTER_TEMPORAL_TEMPORAL' | 'overafter_temporal_temporal'; +OVERAFTER_TSPATIAL_TSPATIAL: 'OVERAFTER_TSPATIAL_TSPATIAL' | 'overafter_tspatial_tspatial'; +OVERBACK_TSPATIAL_TSPATIAL: 'OVERBACK_TSPATIAL_TSPATIAL' | 'overback_tspatial_tspatial'; +OVERBEFORE_TEMPORAL_TEMPORAL: 'OVERBEFORE_TEMPORAL_TEMPORAL' | 'overbefore_temporal_temporal'; +OVERBEFORE_TSPATIAL_TSPATIAL: 'OVERBEFORE_TSPATIAL_TSPATIAL' | 'overbefore_tspatial_tspatial'; +OVERBELOW_TSPATIAL_TSPATIAL: 'OVERBELOW_TSPATIAL_TSPATIAL' | 'overbelow_tspatial_tspatial'; +OVERFRONT_TSPATIAL_TSPATIAL: 'OVERFRONT_TSPATIAL_TSPATIAL' | 'overfront_tspatial_tspatial'; +OVERLAPS_TEMPORAL_TEMPORAL: 'OVERLAPS_TEMPORAL_TEMPORAL' | 'overlaps_temporal_temporal'; +OVERLAPS_TSPATIAL_TSPATIAL: 'OVERLAPS_TSPATIAL_TSPATIAL' | 'overlaps_tspatial_tspatial'; +OVERLEFT_TSPATIAL_TSPATIAL: 'OVERLEFT_TSPATIAL_TSPATIAL' | 'overleft_tspatial_tspatial'; +OVERRIGHT_TSPATIAL_TSPATIAL: 'OVERRIGHT_TSPATIAL_TSPATIAL' | 'overright_tspatial_tspatial'; +RIGHT_TSPATIAL_TSPATIAL: 'RIGHT_TSPATIAL_TSPATIAL' | 'right_tspatial_tspatial'; +SAME_TEMPORAL_TEMPORAL: 'SAME_TEMPORAL_TEMPORAL' | 'same_temporal_temporal'; +SAME_TSPATIAL_TSPATIAL: 'SAME_TSPATIAL_TSPATIAL' | 'same_tspatial_tspatial'; +TBOOL_END_VALUE: 'TBOOL_END_VALUE' | 'tbool_end_value'; +TBOOL_START_VALUE: 'TBOOL_START_VALUE' | 'tbool_start_value'; +TEMPORAL_CMP: 'TEMPORAL_CMP' | 'temporal_cmp'; +TEMPORAL_DYNTIMEWARP_DISTANCE: 'TEMPORAL_DYNTIMEWARP_DISTANCE' | 'temporal_dyntimewarp_distance'; +TEMPORAL_EQ: 'TEMPORAL_EQ' | 'temporal_eq'; +TEMPORAL_FRECHET_DISTANCE: 'TEMPORAL_FRECHET_DISTANCE' | 'temporal_frechet_distance'; +TEMPORAL_GE: 'TEMPORAL_GE' | 'temporal_ge'; +TEMPORAL_GT: 'TEMPORAL_GT' | 'temporal_gt'; +TEMPORAL_HAUSDORFF_DISTANCE: 'TEMPORAL_HAUSDORFF_DISTANCE' | 'temporal_hausdorff_distance'; +TEMPORAL_LE: 'TEMPORAL_LE' | 'temporal_le'; +TEMPORAL_LT: 'TEMPORAL_LT' | 'temporal_lt'; +TEMPORAL_NE: 'TEMPORAL_NE' | 'temporal_ne'; +TNPOINT_LENGTH: 'TNPOINT_LENGTH' | 'tnpoint_length'; +TBOOL_TO_TINT: 'TBOOL_TO_TINT' | 'tbool_to_tint'; +TCBUFFER_TO_TFLOAT: 'TCBUFFER_TO_TFLOAT' | 'tcbuffer_to_tfloat'; +TFLOAT_CEIL: 'TFLOAT_CEIL' | 'tfloat_ceil'; +TFLOAT_EXP: 'TFLOAT_EXP' | 'tfloat_exp'; +TFLOAT_FLOOR: 'TFLOAT_FLOOR' | 'tfloat_floor'; +TFLOAT_LN: 'TFLOAT_LN' | 'tfloat_ln'; +TFLOAT_LOG10: 'TFLOAT_LOG10' | 'tfloat_log10'; +TFLOAT_RADIANS: 'TFLOAT_RADIANS' | 'tfloat_radians'; +TFLOAT_TO_TINT: 'TFLOAT_TO_TINT' | 'tfloat_to_tint'; +TINT_TO_TFLOAT: 'TINT_TO_TFLOAT' | 'tint_to_tfloat'; +ADJACENT_TNUMBER_TBOX: 'ADJACENT_TNUMBER_TBOX' | 'adjacent_tnumber_tbox'; +AFTER_TNUMBER_TBOX: 'AFTER_TNUMBER_TBOX' | 'after_tnumber_tbox'; +BEFORE_TNUMBER_TBOX: 'BEFORE_TNUMBER_TBOX' | 'before_tnumber_tbox'; +CONTAINED_TNUMBER_TBOX: 'CONTAINED_TNUMBER_TBOX' | 'contained_tnumber_tbox'; +CONTAINS_TNUMBER_TBOX: 'CONTAINS_TNUMBER_TBOX' | 'contains_tnumber_tbox'; +LEFT_TNUMBER_TBOX: 'LEFT_TNUMBER_TBOX' | 'left_tnumber_tbox'; +NAD_TCBUFFER_STBOX: 'NAD_TCBUFFER_STBOX' | 'nad_tcbuffer_stbox'; +NAD_TFLOAT_TBOX: 'NAD_TFLOAT_TBOX' | 'nad_tfloat_tbox'; +NAD_TGEO_STBOX: 'NAD_TGEO_STBOX' | 'nad_tgeo_stbox'; +NAD_TINT_TBOX: 'NAD_TINT_TBOX' | 'nad_tint_tbox'; +NAD_TNPOINT_STBOX: 'NAD_TNPOINT_STBOX' | 'nad_tnpoint_stbox'; +NAD_TPOSE_STBOX: 'NAD_TPOSE_STBOX' | 'nad_tpose_stbox'; +OVERAFTER_TNUMBER_TBOX: 'OVERAFTER_TNUMBER_TBOX' | 'overafter_tnumber_tbox'; +OVERBEFORE_TNUMBER_TBOX: 'OVERBEFORE_TNUMBER_TBOX' | 'overbefore_tnumber_tbox'; +OVERLAPS_TNUMBER_TBOX: 'OVERLAPS_TNUMBER_TBOX' | 'overlaps_tnumber_tbox'; +OVERLEFT_TNUMBER_TBOX: 'OVERLEFT_TNUMBER_TBOX' | 'overleft_tnumber_tbox'; +OVERRIGHT_TNUMBER_TBOX: 'OVERRIGHT_TNUMBER_TBOX' | 'overright_tnumber_tbox'; +RIGHT_TNUMBER_TBOX: 'RIGHT_TNUMBER_TBOX' | 'right_tnumber_tbox'; +SAME_TNUMBER_TBOX: 'SAME_TNUMBER_TBOX' | 'same_tnumber_tbox'; +ABOVE_STBOX_TSPATIAL: 'ABOVE_STBOX_TSPATIAL' | 'above_stbox_tspatial'; +ABOVE_TSPATIAL_STBOX: 'ABOVE_TSPATIAL_STBOX' | 'above_tspatial_stbox'; +ADJACENT_STBOX_TSPATIAL: 'ADJACENT_STBOX_TSPATIAL' | 'adjacent_stbox_tspatial'; +ADJACENT_TBOX_TNUMBER: 'ADJACENT_TBOX_TNUMBER' | 'adjacent_tbox_tnumber'; +ADJACENT_TSPATIAL_STBOX: 'ADJACENT_TSPATIAL_STBOX' | 'adjacent_tspatial_stbox'; +AFTER_STBOX_TSPATIAL: 'AFTER_STBOX_TSPATIAL' | 'after_stbox_tspatial'; +AFTER_TBOX_TNUMBER: 'AFTER_TBOX_TNUMBER' | 'after_tbox_tnumber'; +AFTER_TSPATIAL_STBOX: 'AFTER_TSPATIAL_STBOX' | 'after_tspatial_stbox'; +BACK_STBOX_TSPATIAL: 'BACK_STBOX_TSPATIAL' | 'back_stbox_tspatial'; +BACK_TSPATIAL_STBOX: 'BACK_TSPATIAL_STBOX' | 'back_tspatial_stbox'; +BEFORE_STBOX_TSPATIAL: 'BEFORE_STBOX_TSPATIAL' | 'before_stbox_tspatial'; +BEFORE_TBOX_TNUMBER: 'BEFORE_TBOX_TNUMBER' | 'before_tbox_tnumber'; +BEFORE_TSPATIAL_STBOX: 'BEFORE_TSPATIAL_STBOX' | 'before_tspatial_stbox'; +BELOW_STBOX_TSPATIAL: 'BELOW_STBOX_TSPATIAL' | 'below_stbox_tspatial'; +BELOW_TSPATIAL_STBOX: 'BELOW_TSPATIAL_STBOX' | 'below_tspatial_stbox'; +CONTAINED_STBOX_TSPATIAL: 'CONTAINED_STBOX_TSPATIAL' | 'contained_stbox_tspatial'; +CONTAINED_TBOX_TNUMBER: 'CONTAINED_TBOX_TNUMBER' | 'contained_tbox_tnumber'; +CONTAINED_TSPATIAL_STBOX: 'CONTAINED_TSPATIAL_STBOX' | 'contained_tspatial_stbox'; +CONTAINS_STBOX_TSPATIAL: 'CONTAINS_STBOX_TSPATIAL' | 'contains_stbox_tspatial'; +CONTAINS_TBOX_TNUMBER: 'CONTAINS_TBOX_TNUMBER' | 'contains_tbox_tnumber'; +CONTAINS_TSPATIAL_STBOX: 'CONTAINS_TSPATIAL_STBOX' | 'contains_tspatial_stbox'; +FRONT_STBOX_TSPATIAL: 'FRONT_STBOX_TSPATIAL' | 'front_stbox_tspatial'; +FRONT_TSPATIAL_STBOX: 'FRONT_TSPATIAL_STBOX' | 'front_tspatial_stbox'; +LEFT_STBOX_TSPATIAL: 'LEFT_STBOX_TSPATIAL' | 'left_stbox_tspatial'; +LEFT_TBOX_TNUMBER: 'LEFT_TBOX_TNUMBER' | 'left_tbox_tnumber'; +LEFT_TSPATIAL_STBOX: 'LEFT_TSPATIAL_STBOX' | 'left_tspatial_stbox'; +OVERABOVE_STBOX_TSPATIAL: 'OVERABOVE_STBOX_TSPATIAL' | 'overabove_stbox_tspatial'; +OVERABOVE_TSPATIAL_STBOX: 'OVERABOVE_TSPATIAL_STBOX' | 'overabove_tspatial_stbox'; +OVERAFTER_STBOX_TSPATIAL: 'OVERAFTER_STBOX_TSPATIAL' | 'overafter_stbox_tspatial'; +OVERAFTER_TBOX_TNUMBER: 'OVERAFTER_TBOX_TNUMBER' | 'overafter_tbox_tnumber'; +OVERAFTER_TSPATIAL_STBOX: 'OVERAFTER_TSPATIAL_STBOX' | 'overafter_tspatial_stbox'; +OVERBACK_STBOX_TSPATIAL: 'OVERBACK_STBOX_TSPATIAL' | 'overback_stbox_tspatial'; +OVERBACK_TSPATIAL_STBOX: 'OVERBACK_TSPATIAL_STBOX' | 'overback_tspatial_stbox'; +OVERBEFORE_STBOX_TSPATIAL: 'OVERBEFORE_STBOX_TSPATIAL' | 'overbefore_stbox_tspatial'; +OVERBEFORE_TBOX_TNUMBER: 'OVERBEFORE_TBOX_TNUMBER' | 'overbefore_tbox_tnumber'; +OVERBEFORE_TSPATIAL_STBOX: 'OVERBEFORE_TSPATIAL_STBOX' | 'overbefore_tspatial_stbox'; +OVERBELOW_STBOX_TSPATIAL: 'OVERBELOW_STBOX_TSPATIAL' | 'overbelow_stbox_tspatial'; +OVERBELOW_TSPATIAL_STBOX: 'OVERBELOW_TSPATIAL_STBOX' | 'overbelow_tspatial_stbox'; +OVERFRONT_STBOX_TSPATIAL: 'OVERFRONT_STBOX_TSPATIAL' | 'overfront_stbox_tspatial'; +OVERFRONT_TSPATIAL_STBOX: 'OVERFRONT_TSPATIAL_STBOX' | 'overfront_tspatial_stbox'; +OVERLAPS_STBOX_TSPATIAL: 'OVERLAPS_STBOX_TSPATIAL' | 'overlaps_stbox_tspatial'; +OVERLAPS_TBOX_TNUMBER: 'OVERLAPS_TBOX_TNUMBER' | 'overlaps_tbox_tnumber'; +OVERLAPS_TSPATIAL_STBOX: 'OVERLAPS_TSPATIAL_STBOX' | 'overlaps_tspatial_stbox'; +OVERLEFT_STBOX_TSPATIAL: 'OVERLEFT_STBOX_TSPATIAL' | 'overleft_stbox_tspatial'; +OVERLEFT_TBOX_TNUMBER: 'OVERLEFT_TBOX_TNUMBER' | 'overleft_tbox_tnumber'; +OVERLEFT_TSPATIAL_STBOX: 'OVERLEFT_TSPATIAL_STBOX' | 'overleft_tspatial_stbox'; +OVERRIGHT_STBOX_TSPATIAL: 'OVERRIGHT_STBOX_TSPATIAL' | 'overright_stbox_tspatial'; +OVERRIGHT_TBOX_TNUMBER: 'OVERRIGHT_TBOX_TNUMBER' | 'overright_tbox_tnumber'; +OVERRIGHT_TSPATIAL_STBOX: 'OVERRIGHT_TSPATIAL_STBOX' | 'overright_tspatial_stbox'; +RIGHT_STBOX_TSPATIAL: 'RIGHT_STBOX_TSPATIAL' | 'right_stbox_tspatial'; +RIGHT_TBOX_TNUMBER: 'RIGHT_TBOX_TNUMBER' | 'right_tbox_tnumber'; +RIGHT_TSPATIAL_STBOX: 'RIGHT_TSPATIAL_STBOX' | 'right_tspatial_stbox'; +SAME_STBOX_TSPATIAL: 'SAME_STBOX_TSPATIAL' | 'same_stbox_tspatial'; +SAME_TBOX_TNUMBER: 'SAME_TBOX_TNUMBER' | 'same_tbox_tnumber'; +SAME_TSPATIAL_STBOX: 'SAME_TSPATIAL_STBOX' | 'same_tspatial_stbox'; +TPOINT_LENGTH_WKB: 'TPOINT_LENGTH_WKB' | 'tpoint_length_wkb'; +ABOVE_STBOX_STBOX: 'ABOVE_STBOX_STBOX' | 'above_stbox_stbox'; +ADJACENT_STBOX_STBOX: 'ADJACENT_STBOX_STBOX' | 'adjacent_stbox_stbox'; +AFTER_STBOX_STBOX: 'AFTER_STBOX_STBOX' | 'after_stbox_stbox'; +BACK_STBOX_STBOX: 'BACK_STBOX_STBOX' | 'back_stbox_stbox'; +BEFORE_STBOX_STBOX: 'BEFORE_STBOX_STBOX' | 'before_stbox_stbox'; +BELOW_STBOX_STBOX: 'BELOW_STBOX_STBOX' | 'below_stbox_stbox'; +CONTAINED_STBOX_STBOX: 'CONTAINED_STBOX_STBOX' | 'contained_stbox_stbox'; +CONTAINS_STBOX_STBOX: 'CONTAINS_STBOX_STBOX' | 'contains_stbox_stbox'; +FRONT_STBOX_STBOX: 'FRONT_STBOX_STBOX' | 'front_stbox_stbox'; +LEFT_STBOX_STBOX: 'LEFT_STBOX_STBOX' | 'left_stbox_stbox'; +NAD_STBOX_STBOX: 'NAD_STBOX_STBOX' | 'nad_stbox_stbox'; +OVERABOVE_STBOX_STBOX: 'OVERABOVE_STBOX_STBOX' | 'overabove_stbox_stbox'; +OVERAFTER_STBOX_STBOX: 'OVERAFTER_STBOX_STBOX' | 'overafter_stbox_stbox'; +OVERBACK_STBOX_STBOX: 'OVERBACK_STBOX_STBOX' | 'overback_stbox_stbox'; +OVERBEFORE_STBOX_STBOX: 'OVERBEFORE_STBOX_STBOX' | 'overbefore_stbox_stbox'; +OVERBELOW_STBOX_STBOX: 'OVERBELOW_STBOX_STBOX' | 'overbelow_stbox_stbox'; +OVERFRONT_STBOX_STBOX: 'OVERFRONT_STBOX_STBOX' | 'overfront_stbox_stbox'; +OVERLAPS_STBOX_STBOX: 'OVERLAPS_STBOX_STBOX' | 'overlaps_stbox_stbox'; +OVERLEFT_STBOX_STBOX: 'OVERLEFT_STBOX_STBOX' | 'overleft_stbox_stbox'; +OVERRIGHT_STBOX_STBOX: 'OVERRIGHT_STBOX_STBOX' | 'overright_stbox_stbox'; +RIGHT_STBOX_STBOX: 'RIGHT_STBOX_STBOX' | 'right_stbox_stbox'; +SAME_STBOX_STBOX: 'SAME_STBOX_STBOX' | 'same_stbox_stbox'; +STBOX_CMP: 'STBOX_CMP' | 'stbox_cmp'; +STBOX_EQ: 'STBOX_EQ' | 'stbox_eq'; +STBOX_GE: 'STBOX_GE' | 'stbox_ge'; +STBOX_GT: 'STBOX_GT' | 'stbox_gt'; +STBOX_LE: 'STBOX_LE' | 'stbox_le'; +STBOX_LT: 'STBOX_LT' | 'stbox_lt'; +STBOX_NE: 'STBOX_NE' | 'stbox_ne'; +ADJACENT_TNUMBER_TNUMBER: 'ADJACENT_TNUMBER_TNUMBER' | 'adjacent_tnumber_tnumber'; +AFTER_TNUMBER_TNUMBER: 'AFTER_TNUMBER_TNUMBER' | 'after_tnumber_tnumber'; +BEFORE_TNUMBER_TNUMBER: 'BEFORE_TNUMBER_TNUMBER' | 'before_tnumber_tnumber'; +CONTAINED_TNUMBER_TNUMBER: 'CONTAINED_TNUMBER_TNUMBER' | 'contained_tnumber_tnumber'; +CONTAINS_TNUMBER_TNUMBER: 'CONTAINS_TNUMBER_TNUMBER' | 'contains_tnumber_tnumber'; +LEFT_TNUMBER_TNUMBER: 'LEFT_TNUMBER_TNUMBER' | 'left_tnumber_tnumber'; +OVERAFTER_TNUMBER_TNUMBER: 'OVERAFTER_TNUMBER_TNUMBER' | 'overafter_tnumber_tnumber'; +OVERBEFORE_TNUMBER_TNUMBER: 'OVERBEFORE_TNUMBER_TNUMBER' | 'overbefore_tnumber_tnumber'; +OVERLAPS_TNUMBER_TNUMBER: 'OVERLAPS_TNUMBER_TNUMBER' | 'overlaps_tnumber_tnumber'; +OVERLEFT_TNUMBER_TNUMBER: 'OVERLEFT_TNUMBER_TNUMBER' | 'overleft_tnumber_tnumber'; +OVERRIGHT_TNUMBER_TNUMBER: 'OVERRIGHT_TNUMBER_TNUMBER' | 'overright_tnumber_tnumber'; +RIGHT_TNUMBER_TNUMBER: 'RIGHT_TNUMBER_TNUMBER' | 'right_tnumber_tnumber'; +SAME_TNUMBER_TNUMBER: 'SAME_TNUMBER_TNUMBER' | 'same_tnumber_tnumber'; +/* END CODEGEN LEXER TOKENS */ +/* BEGIN CODEGEN AGGREGATION LEXER TOKENS */ +TEMPORAL_NUM_INSTANTS: 'TEMPORAL_NUM_INSTANTS' | 'temporal_num_instants'; +TEMPORAL_NUM_SEQUENCES: 'TEMPORAL_NUM_SEQUENCES' | 'temporal_num_sequences'; +TEMPORAL_NUM_TIMESTAMPS: 'TEMPORAL_NUM_TIMESTAMPS' | 'temporal_num_timestamps'; +TEMPORAL_TFLOAT_START_VALUE: 'TEMPORAL_TFLOAT_START_VALUE' | 'temporal_tfloat_start_value'; +TEMPORAL_TFLOAT_END_VALUE: 'TEMPORAL_TFLOAT_END_VALUE' | 'temporal_tfloat_end_value'; +TEMPORAL_TFLOAT_MIN_VALUE: 'TEMPORAL_TFLOAT_MIN_VALUE' | 'temporal_tfloat_min_value'; +TEMPORAL_TFLOAT_MAX_VALUE: 'TEMPORAL_TFLOAT_MAX_VALUE' | 'temporal_tfloat_max_value'; +TEMPORAL_TNUMBER_INTEGRAL: 'TEMPORAL_TNUMBER_INTEGRAL' | 'temporal_tnumber_integral'; +TEMPORAL_TINT_START_VALUE: 'TEMPORAL_TINT_START_VALUE' | 'temporal_tint_start_value'; +TEMPORAL_TINT_END_VALUE: 'TEMPORAL_TINT_END_VALUE' | 'temporal_tint_end_value'; +TEMPORAL_TINT_MIN_VALUE: 'TEMPORAL_TINT_MIN_VALUE' | 'temporal_tint_min_value'; +TEMPORAL_TINT_MAX_VALUE: 'TEMPORAL_TINT_MAX_VALUE' | 'temporal_tint_max_value'; +TEMPORAL_TFLOAT_AVG_VALUE: 'TEMPORAL_TFLOAT_AVG_VALUE' | 'temporal_tfloat_avg_value'; +TEMPORAL_TNUMBER_TWAVG: 'TEMPORAL_TNUMBER_TWAVG' | 'temporal_tnumber_twavg'; +TEMPORAL_TINT_AVG_VALUE: 'TEMPORAL_TINT_AVG_VALUE' | 'temporal_tint_avg_value'; +TEMPORAL_START_TIMESTAMP: 'TEMPORAL_START_TIMESTAMP' | 'temporal_start_timestamp'; +TEMPORAL_END_TIMESTAMP: 'TEMPORAL_END_TIMESTAMP' | 'temporal_end_timestamp'; +TEMPORAL_LOWER_INC: 'TEMPORAL_LOWER_INC' | 'temporal_lower_inc'; +TEMPORAL_UPPER_INC: 'TEMPORAL_UPPER_INC' | 'temporal_upper_inc'; +TEMPORAL_TPOINT_IS_SIMPLE: 'TEMPORAL_TPOINT_IS_SIMPLE' | 'temporal_tpoint_is_simple'; +TSPATIAL_EXTENT: 'TSPATIAL_EXTENT' | 'tspatial_extent'; +TNUMBER_EXTENT: 'TNUMBER_EXTENT' | 'tnumber_extent'; +FLOAT_EXTENT: 'FLOAT_EXTENT' | 'float_extent'; +INT_EXTENT: 'INT_EXTENT' | 'int_extent'; +BIGINT_EXTENT: 'BIGINT_EXTENT' | 'bigint_extent'; +TIMESTAMPTZ_EXTENT: 'TIMESTAMPTZ_EXTENT' | 'timestamptz_extent'; +FLOAT_UNION: 'FLOAT_UNION' | 'float_union'; +INT_UNION: 'INT_UNION' | 'int_union'; +BIGINT_UNION: 'BIGINT_UNION' | 'bigint_union'; +TIMESTAMPTZ_UNION: 'TIMESTAMPTZ_UNION' | 'timestamptz_union'; +TRAJECTORY_WKB: 'TRAJECTORY_WKB' | 'trajectory_wkb'; +TLENGTH_EXP: 'TLENGTH_EXP' | 'tlength_exp'; +TGEO_CENTROID_EXP: 'TGEO_CENTROID_EXP' | 'tgeo_centroid_exp'; +TPOINT_AZIMUTH_EXP: 'TPOINT_AZIMUTH_EXP' | 'tpoint_azimuth_exp'; +TPOINT_ANGULAR_DIFFERENCE_EXP: 'TPOINT_ANGULAR_DIFFERENCE_EXP' | 'tpoint_angular_difference_exp'; +TGEOMPOINT_TO_TGEOMETRY_EXP: 'TGEOMPOINT_TO_TGEOMETRY_EXP' | 'tgeompoint_to_tgeometry_exp'; +TEMPORAL_COPY_EXP: 'TEMPORAL_COPY_EXP' | 'temporal_copy_exp'; +TNUMBER_ABS_EXP: 'TNUMBER_ABS_EXP' | 'tnumber_abs_exp'; +TNUMBER_DELTA_VALUE_EXP: 'TNUMBER_DELTA_VALUE_EXP' | 'tnumber_delta_value_exp'; +TNUMBER_ANGULAR_DIFFERENCE_EXP: 'TNUMBER_ANGULAR_DIFFERENCE_EXP' | 'tnumber_angular_difference_exp'; +TEMPORAL_DERIVATIVE_EXP: 'TEMPORAL_DERIVATIVE_EXP' | 'temporal_derivative_exp'; +TEMPORAL_AT_MAX_EXP: 'TEMPORAL_AT_MAX_EXP' | 'temporal_at_max_exp'; +TEMPORAL_AT_MIN_EXP: 'TEMPORAL_AT_MIN_EXP' | 'temporal_at_min_exp'; +TEMPORAL_MINUS_MAX_EXP: 'TEMPORAL_MINUS_MAX_EXP' | 'temporal_minus_max_exp'; +TEMPORAL_MINUS_MIN_EXP: 'TEMPORAL_MINUS_MIN_EXP' | 'temporal_minus_min_exp'; +TNPOINT_CUMULATIVE_LENGTH_EXP: 'TNPOINT_CUMULATIVE_LENGTH_EXP' | 'tnpoint_cumulative_length_exp'; +TNPOINT_SPEED_EXP: 'TNPOINT_SPEED_EXP' | 'tnpoint_speed_exp'; +TNPOINT_TO_TGEOMPOINT_EXP: 'TNPOINT_TO_TGEOMPOINT_EXP' | 'tnpoint_to_tgeompoint_exp'; +TPOINT_CUMULATIVE_LENGTH_EXP: 'TPOINT_CUMULATIVE_LENGTH_EXP' | 'tpoint_cumulative_length_exp'; +TPOINT_SPEED_EXP: 'TPOINT_SPEED_EXP' | 'tpoint_speed_exp'; +TPOINT_GET_X_EXP: 'TPOINT_GET_X_EXP' | 'tpoint_get_x_exp'; +TPOINT_GET_Y_EXP: 'TPOINT_GET_Y_EXP' | 'tpoint_get_y_exp'; +TNUMBER_TREND_EXP: 'TNUMBER_TREND_EXP' | 'tnumber_trend_exp'; +TGEO_START_VALUE_EXP: 'TGEO_START_VALUE_EXP' | 'tgeo_start_value_exp'; +TGEO_END_VALUE_EXP: 'TGEO_END_VALUE_EXP' | 'tgeo_end_value_exp'; +TGEO_CONVEX_HULL_EXP: 'TGEO_CONVEX_HULL_EXP' | 'tgeo_convex_hull_exp'; +TPOINT_TWCENTROID_EXP: 'TPOINT_TWCENTROID_EXP' | 'tpoint_twcentroid_exp'; +/* END CODEGEN AGGREGATION LEXER TOKENS */ WATERMARK: 'WATERMARK' | 'watermark'; OFFSET: 'OFFSET' | 'offset'; LOCALHOST: 'LOCALHOST' | 'localhost'; diff --git a/nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp b/nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp index 4e9f1d7642..5568142868 100644 --- a/nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp +++ b/nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp @@ -65,10 +65,434 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -915,14 +1339,14 @@ void AntlrSQLQueryPlanCreator::exitFunctionCall(AntlrSQLParser::FunctionCallCont helpers.top().functionBuilder.pop_back(); const auto longitudeFunction = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); - + // Verify all arguments are field access functions if (!longitudeFunction.tryGet() || !latitudeFunction.tryGet() || !timestampFunction.tryGet()) { throw InvalidQuerySyntax("TEMPORAL_SEQUENCE arguments must be field references"); } - + helpers.top().windowAggs.push_back( TemporalSequenceAggregationLogicalFunctionV2::create(longitudeFunction.get(), latitudeFunction.get(), @@ -932,6 +1356,151 @@ void AntlrSQLQueryPlanCreator::exitFunctionCall(AntlrSQLParser::FunctionCallCont helpers.top().functionBuilder.push_back(longitudeFunction); } break; + case AntlrSQLLexer::TEMPORAL_LENGTH: + // Same three-input shape as TEMPORAL_SEQUENCE; differs only in the + // result type (FLOAT64 instead of VARSIZED). Closes BerlinMOD-Q6 to a + // full streaming-form cell. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_LENGTH requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_LENGTH arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalLengthAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + case AntlrSQLLexer::PAIR_MEETING: + // Five-arg aggregation: lon, lat, ts, vehicle_id (FieldAccess) + dMeet + // (numeric constant — meeting-distance threshold in metres). The first four + // are pulled from functionBuilder; the fifth is pulled from constantBuilder + // (the parser parks numeric/string literals there). Closes Q5 × 3 cells to + // full; this branch makes the dMeet configurable per-query. + { + if (helpers.top().constantBuilder.empty()) { + throw InvalidQuerySyntax( + "PAIR_MEETING requires a numeric constant fifth argument (dMeet metres), " + "e.g. PAIR_MEETING(lon, lat, timestamp, vehicle_id, 200.0)"); + } + auto dMeetString = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + double dMeetMetres; + try { + dMeetMetres = std::stod(dMeetString); + } catch (const std::exception&) { + throw InvalidQuerySyntax( + "PAIR_MEETING fifth argument must be a numeric constant (dMeet metres), got `{}`", + dMeetString); + } + + if (helpers.top().functionBuilder.size() != 4) { + throw InvalidQuerySyntax( + "PAIR_MEETING requires exactly five arguments (lon, lat, timestamp, vehicle_id, dMeet), " + "got {} field args + 1 constant", + helpers.top().functionBuilder.size()); + } + + const auto vidFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet() || + !vidFunction.tryGet()) { + throw InvalidQuerySyntax("PAIR_MEETING field arguments (lon, lat, timestamp, vehicle_id) must be field references"); + } + + helpers.top().windowAggs.push_back( + PairMeetingAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get(), + vidFunction.get(), + dMeetMetres)); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + case AntlrSQLLexer::CROSS_DISTANCE: + // Six-arg aggregation: lon, lat, ts, vehicle_id (FieldAccess) + vidA, vidB + // (numeric constants — target vehicle IDs). The first four are pulled from + // functionBuilder; the fifth and sixth are pulled from constantBuilder. + // Closes Q9 × 3 cells to full; this branch makes the target vehicle pair + // configurable per-query. Mirrors PAIR_MEETING's 5-arg constant-parameterization + // pattern (PR #19). + { + // Pull the two vid constants from constantBuilder. Note: the constants + // are pushed in source order, so the LAST one pushed (vidB in the SQL + // call) is on top of the stack — pop in reverse order. + if (helpers.top().constantBuilder.size() < 2) { + throw InvalidQuerySyntax( + "CROSS_DISTANCE requires two numeric constant arguments (vidA, vidB), " + "e.g. CROSS_DISTANCE(lon, lat, timestamp, vehicle_id, 100, 200)"); + } + auto vidBString = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + auto vidAString = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + uint64_t vidA, vidB; + try { + vidA = std::stoull(vidAString); + vidB = std::stoull(vidBString); + } catch (const std::exception&) { + throw InvalidQuerySyntax( + "CROSS_DISTANCE constant arguments must be unsigned integers (vidA, vidB), got `{}` and `{}`", + vidAString, vidBString); + } + + if (helpers.top().functionBuilder.size() != 4) { + throw InvalidQuerySyntax( + "CROSS_DISTANCE requires exactly six arguments (lon, lat, timestamp, vehicle_id, vidA, vidB), " + "got {} field args + 2 constants", + helpers.top().functionBuilder.size()); + } + + const auto vidFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet() || + !vidFunction.tryGet()) { + throw InvalidQuerySyntax("CROSS_DISTANCE field arguments (lon, lat, timestamp, vehicle_id) must be field references"); + } + + helpers.top().windowAggs.push_back( + CrossDistanceAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get(), + vidFunction.get(), + vidA, vidB)); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; case AntlrSQLLexer::TEMPORAL_EINTERSECTS_GEOMETRY: { // Convert constants from constantBuilder to ConstantValueLogicalFunction objects @@ -1188,42 +1757,12577 @@ void AntlrSQLQueryPlanCreator::exitFunctionCall(AntlrSQLParser::FunctionCallCont } break; - default: - /// Check if the function is a constructor for a datatype - if (const auto dataType = DataTypeProvider::tryProvideDataType(funcName); dataType.has_value()) + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) { - if (helpers.top().constantBuilder.empty()) - { - throw InvalidQuerySyntax("Expected constant, got nothing at {}", context->getText()); - } - helpers.top().hasUnnamedAggregation = false; - auto value = std::move(helpers.top().constantBuilder.back()); + auto v = std::move(helpers.top().constantBuilder.back()); helpers.top().constantBuilder.pop_back(); - auto constFunctionItem = ConstantValueLogicalFunction(*dataType, std::move(value)); - helpers.top().functionBuilder.emplace_back(constFunctionItem); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); } - else if (funcName == "VAR") + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ECONTAINS_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ECONTAINS_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEContainsTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EDISJOINT_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_EDISJOINT_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDisjointTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EINTERSECTS_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_EINTERSECTS_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEIntersectsTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ACONTAINS_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ACONTAINS_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAContainsTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_AINTERSECTS_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_AINTERSECTS_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAIntersectsTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_NAD_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_NAD_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) { - if (helpers.top().functionBuilder.empty()) - { - throw InvalidQuerySyntax("Aggregation requires argument at {}", context->getText()); - } - const auto& lastArg = helpers.top().functionBuilder.back().get(); - helpers.top().windowAggs.push_back(std::make_shared(lastArg)); + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); } - else if (funcName == "TEMPORAL_SEQUENCE") + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_NAD_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_NAD_TGEOMETRY requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EDWITHIN_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 7) + throw InvalidQuerySyntax("TEMPORAL_EDWITHIN_TGEOMETRY requires exactly 7 arguments (lonA, latA, tsA, lonB, latB, tsB, distance), but got {}", argCount); + + /* Lift the distance constant */ + while (!helpers.top().constantBuilder.empty()) { - if (helpers.top().functionBuilder.size() < 3) + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + } + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDWithinTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_GEOMETRY requires exactly 5 arguments (lon, lat, timestamp, geometry, distance), but got {}", argCount); + + /* Lift constants (geometry + distance) — same shape as EDWITHIN_TGEO_GEO */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + const auto upperValue = Util::toUpperCase(constantValue); + if (upperValue == "TRUE" || upperValue == "FALSE") { - throw InvalidQuerySyntax("TEMPORAL_SEQUENCE requires three arguments at {}", context->getText()); + dataType = DataTypeProvider::provideDataType(DataType::Type::BOOLEAN); } - const auto ts = helpers.top().functionBuilder.back().get(); - helpers.top().functionBuilder.pop_back(); - const auto lat = helpers.top().functionBuilder.back().get(); - helpers.top().functionBuilder.pop_back(); - const auto lon = helpers.top().functionBuilder.back().get(); - helpers.top().functionBuilder.pop_back(); - helpers.top().windowAggs.push_back(TemporalSequenceAggregationLogicalFunctionV2::create(lon, lat, ts)); + else + { + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + } + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + /* After lift: [lon, lat, ts, distance, geometry] (geometry pushed last because lifted last in LIFO) */ + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinGeometryLogicalFunction(lon, lat, timestamp, geometry, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TGEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_TGEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 7) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_TGEOMETRY requires exactly 7 arguments (lonA, latA, tsA, lonB, latB, tsB, distance), but got {}", argCount); + + /* Lift the distance constant */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + } + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinTGeometryLogicalFunction(lonA, latA, tsA, lonB, latB, tsB, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TGEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EDISJOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_EDISJOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDisjointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ACONTAINS_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ACONTAINS_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAContainsGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_GEOMETRY */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_FLOAT_SCALAR */ + case AntlrSQLLexer::TEMPORAL_NAD_FLOAT_SCALAR: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("TEMPORAL_NAD_FLOAT_SCALAR requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADFloatScalarLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_FLOAT_SCALAR */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_INT_SCALAR */ + case AntlrSQLLexer::TEMPORAL_NAD_INT_SCALAR: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("TEMPORAL_NAD_INT_SCALAR requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADIntScalarLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_INT_SCALAR */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TFLOAT */ + case AntlrSQLLexer::TEMPORAL_NAD_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_NAD_TFLOAT requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTFloatLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TINT */ + case AntlrSQLLexer::TEMPORAL_NAD_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_NAD_TINT requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTIntLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TINT */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_AT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_AT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAtGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_MINUS_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_MINUS_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_MINUS_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalMinusGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_MINUS_GEOMETRY */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ECONTAINS_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ECONTAINS_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEContainsTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_EDISJOINT_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_EDISJOINT_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDisjointTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_EINTERSECTS_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_EINTERSECTS_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEIntersectsTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ACONTAINS_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ACONTAINS_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAContainsTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACOVERS_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ACOVERS_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ACOVERS_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalACoversTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACOVERS_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_AINTERSECTS_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_AINTERSECTS_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAIntersectsTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TCBUFFER */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_ECONTAINS_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ECONTAINS_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEContainsTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_EDISJOINT_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_EDISJOINT_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDisjointTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_EINTERSECTS_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_EINTERSECTS_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEIntersectsTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_ACONTAINS_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ACONTAINS_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAContainsTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACOVERS_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_ACOVERS_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ACOVERS_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalACoversTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACOVERS_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_AINTERSECTS_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_AINTERSECTS_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAIntersectsTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TCBUFFER_CBUFFER */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_AINTERSECTS_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_AINTERSECTS_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAIntersectsTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_EINTERSECTS_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_EINTERSECTS_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEIntersectsTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TCBUFFER_TCBUFFER */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TCBUFFER_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EDWITHIN_TCBUFFER_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_EDWITHIN_TCBUFFER_GEOMETRY requires exactly 6 arguments (lon, lat, radius, timestamp, blob, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto blobLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto distLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDWithinTCbufferGeometryLogicalFunction(lon, lat, radius, timestamp, blobLast, distLast)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TCBUFFER_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TCBUFFER_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_TCBUFFER_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_TCBUFFER_GEOMETRY requires exactly 6 arguments (lon, lat, radius, timestamp, blob, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto blobLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto distLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinTCbufferGeometryLogicalFunction(lon, lat, radius, timestamp, blobLast, distLast)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TCBUFFER_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_EDWITHIN_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_EDWITHIN_TCBUFFER_CBUFFER requires exactly 6 arguments (lon, lat, radius, timestamp, blob, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto blobLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto distLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDWithinTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, blobLast, distLast)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_TCBUFFER_CBUFFER requires exactly 6 arguments (lon, lat, radius, timestamp, blob, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto blobLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto distLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, blobLast, distLast)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_EDWITHIN_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 9) + throw InvalidQuerySyntax("TEMPORAL_EDWITHIN_TCBUFFER_TCBUFFER requires exactly 9 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + } + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDWithinTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 9) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_TCBUFFER_TCBUFFER requires exactly 9 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + } + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TCBUFFER_TCBUFFER */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ECONTAINS_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ECONTAINS_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEContainsTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EDISJOINT_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_EDISJOINT_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDisjointTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EINTERSECTS_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_EINTERSECTS_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEIntersectsTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ACONTAINS_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ACONTAINS_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAContainsTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_AINTERSECTS_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_AINTERSECTS_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAIntersectsTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TPOSE_GEOMETRY */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_ECONTAINS_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ECONTAINS_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEContainsTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_EDISJOINT_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_EDISJOINT_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDisjointTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_EINTERSECTS_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_EINTERSECTS_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEIntersectsTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_ACONTAINS_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ACONTAINS_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAContainsTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_AINTERSECTS_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_AINTERSECTS_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAIntersectsTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TPOSE_TPOSE */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ECONTAINS_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ECONTAINS_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEContainsTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_ECONTAINS_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ECONTAINS_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEContainsTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECONTAINS_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_ECOVERS_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ECOVERS_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalECoversTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ECOVERS_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EDISJOINT_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_EDISJOINT_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDisjointTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_EDISJOINT_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_EDISJOINT_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDisjointTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDISJOINT_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EINTERSECTS_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_EINTERSECTS_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEIntersectsTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_EINTERSECTS_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_EINTERSECTS_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEIntersectsTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EINTERSECTS_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_ETOUCHES_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ETOUCHES_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalETouchesTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ETOUCHES_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ACONTAINS_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ACONTAINS_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAContainsTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_ACONTAINS_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ACONTAINS_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAContainsTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ACONTAINS_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_ADISJOINT_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ADISJOINT_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADisjointTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADISJOINT_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_AINTERSECTS_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_AINTERSECTS_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAIntersectsTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_AINTERSECTS_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_AINTERSECTS_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalAIntersectsTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_AINTERSECTS_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_ATOUCHES_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ATOUCHES_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalATouchesTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ATOUCHES_TNPOINT_TNPOINT */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_NAD_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_NAD_TPOSE_GEOMETRY requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_NAD_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_NAD_TPOSE_TPOSE requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTPoseTPoseLogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_NAD_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TEMPORAL_NAD_TNPOINT_GEOMETRY requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_NAD_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_NAD_TNPOINT_TNPOINT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TNPOINT_TNPOINT */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EDWITHIN_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_EDWITHIN_TPOSE_GEOMETRY requires exactly 6 arguments (lon, lat, radius, timestamp, blob, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto blobLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto distLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDWithinTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, blobLast, distLast)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_EDWITHIN_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 9) + throw InvalidQuerySyntax("TEMPORAL_EDWITHIN_TPOSE_TPOSE requires exactly 9 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + } + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDWithinTPoseTPoseLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_EDWITHIN_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_EDWITHIN_TNPOINT_GEOMETRY requires exactly 5 arguments (lon, lat, timestamp, geometry, distance), but got {}", argCount); + + /* Lift constants (geometry + distance) — same shape as EDWITHIN_TGEO_GEO */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + const auto upperValue = Util::toUpperCase(constantValue); + if (upperValue == "TRUE" || upperValue == "FALSE") + { + dataType = DataTypeProvider::provideDataType(DataType::Type::BOOLEAN); + } + else + { + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + } + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + /* After lift: [lon, lat, ts, distance, geometry] (geometry pushed last because lifted last in LIFO) */ + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDWithinTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_EDWITHIN_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 7) + throw InvalidQuerySyntax("TEMPORAL_EDWITHIN_TNPOINT_TNPOINT requires exactly 7 arguments (lonA, latA, tsA, lonB, latB, tsB, distance), but got {}", argCount); + + /* Lift the distance constant */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + } + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEDWithinTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EDWITHIN_TNPOINT_TNPOINT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TPOSE_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_TPOSE_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_TPOSE_GEOMETRY requires exactly 6 arguments (lon, lat, radius, timestamp, blob, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto blobLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto distLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinTPoseGeometryLogicalFunction(lon, lat, radius, timestamp, blobLast, distLast)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TPOSE_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TPOSE_TPOSE */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_TPOSE_TPOSE: + { + const auto argCount = context->expression().size(); + if (argCount != 9) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_TPOSE_TPOSE requires exactly 9 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, distance), but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + } + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinTPoseTPoseLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TPOSE_TPOSE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TNPOINT_GEOMETRY */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_TNPOINT_GEOMETRY: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_TNPOINT_GEOMETRY requires exactly 5 arguments (lon, lat, timestamp, geometry, distance), but got {}", argCount); + + /* Lift constants (geometry + distance) — same shape as EDWITHIN_TGEO_GEO */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + const auto upperValue = Util::toUpperCase(constantValue); + if (upperValue == "TRUE" || upperValue == "FALSE") + { + dataType = DataTypeProvider::provideDataType(DataType::Type::BOOLEAN); + } + else + { + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + } + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + /* After lift: [lon, lat, ts, distance, geometry] (geometry pushed last because lifted last in LIFO) */ + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinTNpointGeometryLogicalFunction(lon, lat, timestamp, geometry, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TNPOINT_GEOMETRY */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TNPOINT_TNPOINT */ + case AntlrSQLLexer::TEMPORAL_ADWITHIN_TNPOINT_TNPOINT: + { + const auto argCount = context->expression().size(); + if (argCount != 7) + throw InvalidQuerySyntax("TEMPORAL_ADWITHIN_TNPOINT_TNPOINT requires exactly 7 arguments (lonA, latA, tsA, lonB, latB, tsB, distance), but got {}", argCount); + + /* Lift the distance constant */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + } + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalADWithinTNpointTNpointLogicalFunction(lonA, latA, tsA, lonB, latB, tsB, dist)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_ADWITHIN_TNPOINT_TNPOINT */ + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_NAD_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_NAD_TCBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::TEMPORAL_NAD_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("TEMPORAL_NAD_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTCbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NAD_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::TEMPORAL_NAD_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("TEMPORAL_NAD_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNADTCbufferTCbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NAD_TCBUFFER_TCBUFFER */ + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_TFLOAT_FLOAT */ + case AntlrSQLLexer::ALWAYS_EQ_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_EQ_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_TINT_INT */ + case AntlrSQLLexer::ALWAYS_EQ_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_EQ_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GE_TFLOAT_FLOAT */ + case AntlrSQLLexer::ALWAYS_GE_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_GE_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGeTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GE_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GE_TINT_INT */ + case AntlrSQLLexer::ALWAYS_GE_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_GE_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGeTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GE_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GT_TFLOAT_FLOAT */ + case AntlrSQLLexer::ALWAYS_GT_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_GT_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGtTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GT_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GT_TINT_INT */ + case AntlrSQLLexer::ALWAYS_GT_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_GT_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGtTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GT_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LE_TFLOAT_FLOAT */ + case AntlrSQLLexer::ALWAYS_LE_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_LE_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLeTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LE_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LE_TINT_INT */ + case AntlrSQLLexer::ALWAYS_LE_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_LE_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLeTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LE_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LT_TFLOAT_FLOAT */ + case AntlrSQLLexer::ALWAYS_LT_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_LT_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLtTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LT_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LT_TINT_INT */ + case AntlrSQLLexer::ALWAYS_LT_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_LT_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLtTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LT_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_TFLOAT_FLOAT */ + case AntlrSQLLexer::ALWAYS_NE_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_NE_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_TINT_INT */ + case AntlrSQLLexer::ALWAYS_NE_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_NE_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_TFLOAT_FLOAT */ + case AntlrSQLLexer::EVER_EQ_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_EQ_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_TINT_INT */ + case AntlrSQLLexer::EVER_EQ_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_EQ_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GE_TFLOAT_FLOAT */ + case AntlrSQLLexer::EVER_GE_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_GE_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGeTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GE_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GE_TINT_INT */ + case AntlrSQLLexer::EVER_GE_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_GE_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGeTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GE_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GT_TFLOAT_FLOAT */ + case AntlrSQLLexer::EVER_GT_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_GT_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGtTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GT_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GT_TINT_INT */ + case AntlrSQLLexer::EVER_GT_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_GT_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGtTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GT_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LE_TFLOAT_FLOAT */ + case AntlrSQLLexer::EVER_LE_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_LE_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLeTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LE_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LE_TINT_INT */ + case AntlrSQLLexer::EVER_LE_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_LE_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLeTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LE_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LT_TFLOAT_FLOAT */ + case AntlrSQLLexer::EVER_LT_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_LT_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLtTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LT_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LT_TINT_INT */ + case AntlrSQLLexer::EVER_LT_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_LT_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLtTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LT_TINT_INT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_TFLOAT_FLOAT */ + case AntlrSQLLexer::EVER_NE_TFLOAT_FLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_NE_TFLOAT_FLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeTfloatFloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_TFLOAT_FLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_TINT_INT */ + case AntlrSQLLexer::EVER_NE_TINT_INT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_NE_TINT_INT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeTintIntLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_TINT_INT */ + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_FLOAT_TFLOAT */ + case AntlrSQLLexer::ALWAYS_EQ_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_EQ_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_INT_TINT */ + case AntlrSQLLexer::ALWAYS_EQ_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_EQ_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::ALWAYS_EQ_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ALWAYS_EQ_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GE_FLOAT_TFLOAT */ + case AntlrSQLLexer::ALWAYS_GE_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_GE_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGeFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GE_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GE_INT_TINT */ + case AntlrSQLLexer::ALWAYS_GE_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_GE_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGeIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GE_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GE_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::ALWAYS_GE_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ALWAYS_GE_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGeTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GE_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GT_FLOAT_TFLOAT */ + case AntlrSQLLexer::ALWAYS_GT_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_GT_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGtFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GT_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GT_INT_TINT */ + case AntlrSQLLexer::ALWAYS_GT_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_GT_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGtIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GT_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_GT_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::ALWAYS_GT_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ALWAYS_GT_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysGtTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_GT_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LE_FLOAT_TFLOAT */ + case AntlrSQLLexer::ALWAYS_LE_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_LE_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLeFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LE_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LE_INT_TINT */ + case AntlrSQLLexer::ALWAYS_LE_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_LE_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLeIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LE_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LE_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::ALWAYS_LE_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ALWAYS_LE_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLeTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LE_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LT_FLOAT_TFLOAT */ + case AntlrSQLLexer::ALWAYS_LT_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_LT_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLtFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LT_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LT_INT_TINT */ + case AntlrSQLLexer::ALWAYS_LT_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_LT_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLtIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LT_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_LT_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::ALWAYS_LT_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ALWAYS_LT_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysLtTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_LT_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_FLOAT_TFLOAT */ + case AntlrSQLLexer::ALWAYS_NE_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_NE_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_INT_TINT */ + case AntlrSQLLexer::ALWAYS_NE_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_NE_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::ALWAYS_NE_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ALWAYS_NE_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_FLOAT_TFLOAT */ + case AntlrSQLLexer::EVER_EQ_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_EQ_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_INT_TINT */ + case AntlrSQLLexer::EVER_EQ_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_EQ_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::EVER_EQ_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("EVER_EQ_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GE_FLOAT_TFLOAT */ + case AntlrSQLLexer::EVER_GE_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_GE_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGeFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GE_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GE_INT_TINT */ + case AntlrSQLLexer::EVER_GE_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_GE_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGeIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GE_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GE_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::EVER_GE_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("EVER_GE_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGeTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GE_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GT_FLOAT_TFLOAT */ + case AntlrSQLLexer::EVER_GT_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_GT_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGtFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GT_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GT_INT_TINT */ + case AntlrSQLLexer::EVER_GT_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_GT_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGtIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GT_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_GT_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::EVER_GT_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("EVER_GT_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverGtTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_GT_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LE_FLOAT_TFLOAT */ + case AntlrSQLLexer::EVER_LE_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_LE_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLeFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LE_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LE_INT_TINT */ + case AntlrSQLLexer::EVER_LE_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_LE_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLeIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LE_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LE_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::EVER_LE_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("EVER_LE_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLeTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LE_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LT_FLOAT_TFLOAT */ + case AntlrSQLLexer::EVER_LT_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_LT_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLtFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LT_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LT_INT_TINT */ + case AntlrSQLLexer::EVER_LT_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_LT_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLtIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LT_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_LT_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::EVER_LT_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("EVER_LT_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverLtTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_LT_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_FLOAT_TFLOAT */ + case AntlrSQLLexer::EVER_NE_FLOAT_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_NE_FLOAT_TFLOAT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeFloatTfloatLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_FLOAT_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_INT_TINT */ + case AntlrSQLLexer::EVER_NE_INT_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_NE_INT_TINT requires exactly 3 arguments (value, timestamp, scalar), but got {}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeIntTintLogicalFunction(value, timestamp, scalar)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_INT_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::EVER_NE_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("EVER_NE_TEMPORAL_TEMPORAL requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeTemporalTemporalLogicalFunction(valueA, tsA, valueB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_TEMPORAL_TEMPORAL */ + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::ALWAYS_EQ_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("ALWAYS_EQ_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqTcbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::ALWAYS_EQ_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("ALWAYS_EQ_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqTcbufferTcbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_TGEO_GEO */ + case AntlrSQLLexer::ALWAYS_EQ_TGEO_GEO: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ALWAYS_EQ_TGEO_GEO requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqTgeoGeoLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_TGEO_GEO */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_TGEO_TGEO */ + case AntlrSQLLexer::ALWAYS_EQ_TGEO_TGEO: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("ALWAYS_EQ_TGEO_TGEO requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysEqTgeoTgeoLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_TGEO_TGEO */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::ALWAYS_NE_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("ALWAYS_NE_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeTcbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::ALWAYS_NE_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("ALWAYS_NE_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeTcbufferTcbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_TGEO_GEO */ + case AntlrSQLLexer::ALWAYS_NE_TGEO_GEO: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ALWAYS_NE_TGEO_GEO requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeTgeoGeoLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_TGEO_GEO */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_TGEO_TGEO */ + case AntlrSQLLexer::ALWAYS_NE_TGEO_TGEO: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("ALWAYS_NE_TGEO_TGEO requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AlwaysNeTgeoTgeoLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_TGEO_TGEO */ + + /* BEGIN CODEGEN PARSER GLUE: ATOUCHES_TPOINT_GEO */ + case AntlrSQLLexer::ATOUCHES_TPOINT_GEO: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ATOUCHES_TPOINT_GEO requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AtouchesTpointGeoLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: ATOUCHES_TPOINT_GEO */ + + /* BEGIN CODEGEN PARSER GLUE: ETOUCHES_TPOINT_GEO */ + case AntlrSQLLexer::ETOUCHES_TPOINT_GEO: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ETOUCHES_TPOINT_GEO requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EtouchesTpointGeoLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: ETOUCHES_TPOINT_GEO */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::EVER_EQ_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("EVER_EQ_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqTcbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::EVER_EQ_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("EVER_EQ_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqTcbufferTcbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_TGEO_GEO */ + case AntlrSQLLexer::EVER_EQ_TGEO_GEO: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("EVER_EQ_TGEO_GEO requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqTgeoGeoLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_TGEO_GEO */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_TGEO_TGEO */ + case AntlrSQLLexer::EVER_EQ_TGEO_TGEO: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("EVER_EQ_TGEO_TGEO requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverEqTgeoTgeoLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_TGEO_TGEO */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_TCBUFFER_CBUFFER */ + case AntlrSQLLexer::EVER_NE_TCBUFFER_CBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("EVER_NE_TCBUFFER_CBUFFER requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeTcbufferCbufferLogicalFunction(lon, lat, radius, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_TCBUFFER_CBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_TCBUFFER_TCBUFFER */ + case AntlrSQLLexer::EVER_NE_TCBUFFER_TCBUFFER: + { + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("EVER_NE_TCBUFFER_TCBUFFER requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeTcbufferTcbufferLogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_TCBUFFER_TCBUFFER */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_TGEO_GEO */ + case AntlrSQLLexer::EVER_NE_TGEO_GEO: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("EVER_NE_TGEO_GEO requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + { + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + } + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeTgeoGeoLogicalFunction(lon, lat, timestamp, geometry)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_TGEO_GEO */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_TGEO_TGEO */ + case AntlrSQLLexer::EVER_NE_TGEO_TGEO: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("EVER_NE_TGEO_TGEO requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + EverNeTgeoTgeoLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_TGEO_TGEO */ + /* BEGIN CODEGEN PARSER GLUE: ABOVE_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::ABOVE_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("ABOVE_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AboveTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ABOVE_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: ADJACENT_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::ADJACENT_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("ADJACENT_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AdjacentTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ADJACENT_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: ADJACENT_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::ADJACENT_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("ADJACENT_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AdjacentTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: ADJACENT_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: AFTER_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::AFTER_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("AFTER_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AfterTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: AFTER_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: AFTER_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::AFTER_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("AFTER_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + AfterTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: AFTER_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_EQ_TBOOL_BOOL */ + case AntlrSQLLexer::ALWAYS_EQ_TBOOL_BOOL: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_EQ_TBOOL_BOOL requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AlwaysEqTboolBoolLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_EQ_TBOOL_BOOL */ + + /* BEGIN CODEGEN PARSER GLUE: ALWAYS_NE_TBOOL_BOOL */ + case AntlrSQLLexer::ALWAYS_NE_TBOOL_BOOL: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ALWAYS_NE_TBOOL_BOOL requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AlwaysNeTboolBoolLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: ALWAYS_NE_TBOOL_BOOL */ + + /* BEGIN CODEGEN PARSER GLUE: BACK_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::BACK_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("BACK_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + BackTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: BACK_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: BEFORE_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::BEFORE_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("BEFORE_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + BeforeTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: BEFORE_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: BEFORE_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::BEFORE_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("BEFORE_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + BeforeTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: BEFORE_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: BELOW_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::BELOW_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("BELOW_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + BelowTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: BELOW_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINED_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::CONTAINED_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("CONTAINED_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + ContainedTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINED_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINED_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::CONTAINED_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("CONTAINED_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + ContainedTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINED_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINS_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::CONTAINS_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("CONTAINS_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + ContainsTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINS_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINS_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::CONTAINS_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("CONTAINS_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + ContainsTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINS_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_EQ_TBOOL_BOOL */ + case AntlrSQLLexer::EVER_EQ_TBOOL_BOOL: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_EQ_TBOOL_BOOL requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(EverEqTboolBoolLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_EQ_TBOOL_BOOL */ + + /* BEGIN CODEGEN PARSER GLUE: EVER_NE_TBOOL_BOOL */ + case AntlrSQLLexer::EVER_NE_TBOOL_BOOL: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("EVER_NE_TBOOL_BOOL requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(EverNeTboolBoolLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: EVER_NE_TBOOL_BOOL */ + + /* BEGIN CODEGEN PARSER GLUE: FRONT_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::FRONT_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("FRONT_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + FrontTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: FRONT_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: LEFT_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::LEFT_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("LEFT_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + LeftTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: LEFT_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_TNPOINT_GEO */ + case AntlrSQLLexer::NAD_TNPOINT_GEO: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("NAD_TNPOINT_GEO requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadTnpointGeoLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_TNPOINT_GEO */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_TPOSE_GEO */ + case AntlrSQLLexer::NAD_TPOSE_GEO: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("NAD_TPOSE_GEO requires exactly 5 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a4 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadTposeGeoLogicalFunction(a0, a1, a2, a3, a4)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_TPOSE_GEO */ + + /* BEGIN CODEGEN PARSER GLUE: OVERABOVE_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERABOVE_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERABOVE_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OveraboveTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERABOVE_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERAFTER_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::OVERAFTER_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERAFTER_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverafterTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERAFTER_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERAFTER_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERAFTER_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERAFTER_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverafterTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERAFTER_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBACK_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERBACK_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERBACK_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverbackTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBACK_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBEFORE_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::OVERBEFORE_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERBEFORE_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverbeforeTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBEFORE_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBEFORE_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERBEFORE_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERBEFORE_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverbeforeTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBEFORE_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBELOW_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERBELOW_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERBELOW_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverbelowTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBELOW_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERFRONT_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERFRONT_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERFRONT_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverfrontTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERFRONT_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLAPS_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::OVERLAPS_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERLAPS_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverlapsTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLAPS_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLAPS_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERLAPS_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERLAPS_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverlapsTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLAPS_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLEFT_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERLEFT_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERLEFT_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverleftTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLEFT_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERRIGHT_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::OVERRIGHT_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("OVERRIGHT_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + OverrightTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: OVERRIGHT_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: RIGHT_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::RIGHT_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("RIGHT_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + RightTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: RIGHT_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: SAME_TEMPORAL_TEMPORAL */ + case AntlrSQLLexer::SAME_TEMPORAL_TEMPORAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("SAME_TEMPORAL_TEMPORAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + SameTemporalTemporalLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: SAME_TEMPORAL_TEMPORAL */ + + /* BEGIN CODEGEN PARSER GLUE: SAME_TSPATIAL_TSPATIAL */ + case AntlrSQLLexer::SAME_TSPATIAL_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("SAME_TSPATIAL_TSPATIAL requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + SameTspatialTspatialLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: SAME_TSPATIAL_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: TBOOL_END_VALUE */ + case AntlrSQLLexer::TBOOL_END_VALUE: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TBOOL_END_VALUE requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TboolEndValueLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TBOOL_END_VALUE */ + + /* BEGIN CODEGEN PARSER GLUE: TBOOL_START_VALUE */ + case AntlrSQLLexer::TBOOL_START_VALUE: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TBOOL_START_VALUE requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TboolStartValueLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TBOOL_START_VALUE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_CMP */ + case AntlrSQLLexer::TEMPORAL_CMP: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_CMP requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalCmpLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_CMP */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_DYNTIMEWARP_DISTANCE */ + case AntlrSQLLexer::TEMPORAL_DYNTIMEWARP_DISTANCE: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_DYNTIMEWARP_DISTANCE requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalDyntimewarpDistanceLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_DYNTIMEWARP_DISTANCE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_EQ */ + case AntlrSQLLexer::TEMPORAL_EQ: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_EQ requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalEqLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_EQ */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_FRECHET_DISTANCE */ + case AntlrSQLLexer::TEMPORAL_FRECHET_DISTANCE: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_FRECHET_DISTANCE requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalFrechetDistanceLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_FRECHET_DISTANCE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_GE */ + case AntlrSQLLexer::TEMPORAL_GE: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_GE requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalGeLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_GE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_GT */ + case AntlrSQLLexer::TEMPORAL_GT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_GT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalGtLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_GT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_HAUSDORFF_DISTANCE */ + case AntlrSQLLexer::TEMPORAL_HAUSDORFF_DISTANCE: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_HAUSDORFF_DISTANCE requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalHausdorffDistanceLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_HAUSDORFF_DISTANCE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_LE */ + case AntlrSQLLexer::TEMPORAL_LE: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_LE requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalLeLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_LE */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_LT */ + case AntlrSQLLexer::TEMPORAL_LT: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_LT requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalLtLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_LT */ + + /* BEGIN CODEGEN PARSER GLUE: TEMPORAL_NE */ + case AntlrSQLLexer::TEMPORAL_NE: + { + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("TEMPORAL_NE requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + TemporalNeLogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + } + break; + /* END CODEGEN PARSER GLUE: TEMPORAL_NE */ + + /* BEGIN CODEGEN PARSER GLUE: TNPOINT_LENGTH */ + case AntlrSQLLexer::TNPOINT_LENGTH: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("TNPOINT_LENGTH requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TnpointLengthLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: TNPOINT_LENGTH */ + /* BEGIN CODEGEN PARSER GLUE: TBOOL_TO_TINT */ + case AntlrSQLLexer::TBOOL_TO_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TBOOL_TO_TINT requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TboolToTintLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TBOOL_TO_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: TCBUFFER_TO_TFLOAT */ + case AntlrSQLLexer::TCBUFFER_TO_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("TCBUFFER_TO_TFLOAT requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TcbufferToTfloatLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: TCBUFFER_TO_TFLOAT */ + + /* BEGIN CODEGEN PARSER GLUE: TFLOAT_CEIL */ + case AntlrSQLLexer::TFLOAT_CEIL: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TFLOAT_CEIL requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TfloatCeilLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TFLOAT_CEIL */ + + /* BEGIN CODEGEN PARSER GLUE: TFLOAT_EXP */ + case AntlrSQLLexer::TFLOAT_EXP: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TFLOAT_EXP requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TfloatExpLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TFLOAT_EXP */ + + /* BEGIN CODEGEN PARSER GLUE: TFLOAT_FLOOR */ + case AntlrSQLLexer::TFLOAT_FLOOR: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TFLOAT_FLOOR requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TfloatFloorLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TFLOAT_FLOOR */ + + /* BEGIN CODEGEN PARSER GLUE: TFLOAT_LN */ + case AntlrSQLLexer::TFLOAT_LN: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TFLOAT_LN requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TfloatLnLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TFLOAT_LN */ + + /* BEGIN CODEGEN PARSER GLUE: TFLOAT_LOG10 */ + case AntlrSQLLexer::TFLOAT_LOG10: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TFLOAT_LOG10 requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TfloatLog10LogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TFLOAT_LOG10 */ + + /* BEGIN CODEGEN PARSER GLUE: TFLOAT_RADIANS */ + case AntlrSQLLexer::TFLOAT_RADIANS: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TFLOAT_RADIANS requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TfloatRadiansLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TFLOAT_RADIANS */ + + /* BEGIN CODEGEN PARSER GLUE: TFLOAT_TO_TINT */ + case AntlrSQLLexer::TFLOAT_TO_TINT: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TFLOAT_TO_TINT requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TfloatToTintLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TFLOAT_TO_TINT */ + + /* BEGIN CODEGEN PARSER GLUE: TINT_TO_TFLOAT */ + case AntlrSQLLexer::TINT_TO_TFLOAT: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("TINT_TO_TFLOAT requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TintToTfloatLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: TINT_TO_TFLOAT */ + /* BEGIN CODEGEN PARSER GLUE: ADJACENT_TNUMBER_TBOX */ + case AntlrSQLLexer::ADJACENT_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ADJACENT_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AdjacentTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: ADJACENT_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: AFTER_TNUMBER_TBOX */ + case AntlrSQLLexer::AFTER_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("AFTER_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AfterTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: AFTER_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: BEFORE_TNUMBER_TBOX */ + case AntlrSQLLexer::BEFORE_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("BEFORE_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BeforeTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: BEFORE_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINED_TNUMBER_TBOX */ + case AntlrSQLLexer::CONTAINED_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("CONTAINED_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainedTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINED_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINS_TNUMBER_TBOX */ + case AntlrSQLLexer::CONTAINS_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("CONTAINS_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainsTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINS_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: LEFT_TNUMBER_TBOX */ + case AntlrSQLLexer::LEFT_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("LEFT_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(LeftTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: LEFT_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_TCBUFFER_STBOX */ + case AntlrSQLLexer::NAD_TCBUFFER_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("NAD_TCBUFFER_STBOX requires exactly 5 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a4 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadTcbufferStboxLogicalFunction(a0, a1, a2, a3, a4)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_TCBUFFER_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_TFLOAT_TBOX */ + case AntlrSQLLexer::NAD_TFLOAT_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("NAD_TFLOAT_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadTfloatTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_TFLOAT_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_TGEO_STBOX */ + case AntlrSQLLexer::NAD_TGEO_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("NAD_TGEO_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadTgeoStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_TGEO_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_TINT_TBOX */ + case AntlrSQLLexer::NAD_TINT_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("NAD_TINT_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadTintTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_TINT_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_TNPOINT_STBOX */ + case AntlrSQLLexer::NAD_TNPOINT_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("NAD_TNPOINT_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadTnpointStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_TNPOINT_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_TPOSE_STBOX */ + case AntlrSQLLexer::NAD_TPOSE_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("NAD_TPOSE_STBOX requires exactly 5 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a4 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadTposeStboxLogicalFunction(a0, a1, a2, a3, a4)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_TPOSE_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERAFTER_TNUMBER_TBOX */ + case AntlrSQLLexer::OVERAFTER_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERAFTER_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverafterTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERAFTER_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBEFORE_TNUMBER_TBOX */ + case AntlrSQLLexer::OVERBEFORE_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERBEFORE_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbeforeTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBEFORE_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLAPS_TNUMBER_TBOX */ + case AntlrSQLLexer::OVERLAPS_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERLAPS_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverlapsTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLAPS_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLEFT_TNUMBER_TBOX */ + case AntlrSQLLexer::OVERLEFT_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERLEFT_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverleftTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLEFT_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERRIGHT_TNUMBER_TBOX */ + case AntlrSQLLexer::OVERRIGHT_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERRIGHT_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverrightTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERRIGHT_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: RIGHT_TNUMBER_TBOX */ + case AntlrSQLLexer::RIGHT_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("RIGHT_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(RightTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: RIGHT_TNUMBER_TBOX */ + + /* BEGIN CODEGEN PARSER GLUE: SAME_TNUMBER_TBOX */ + case AntlrSQLLexer::SAME_TNUMBER_TBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("SAME_TNUMBER_TBOX requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(SameTnumberTboxLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: SAME_TNUMBER_TBOX */ + /* BEGIN CODEGEN PARSER GLUE: ABOVE_STBOX_TSPATIAL */ + case AntlrSQLLexer::ABOVE_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ABOVE_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AboveStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: ABOVE_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: ABOVE_TSPATIAL_STBOX */ + case AntlrSQLLexer::ABOVE_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ABOVE_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AboveTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: ABOVE_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: ADJACENT_STBOX_TSPATIAL */ + case AntlrSQLLexer::ADJACENT_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ADJACENT_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AdjacentStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: ADJACENT_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: ADJACENT_TBOX_TNUMBER */ + case AntlrSQLLexer::ADJACENT_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("ADJACENT_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AdjacentTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: ADJACENT_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: ADJACENT_TSPATIAL_STBOX */ + case AntlrSQLLexer::ADJACENT_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("ADJACENT_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AdjacentTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: ADJACENT_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: AFTER_STBOX_TSPATIAL */ + case AntlrSQLLexer::AFTER_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("AFTER_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AfterStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: AFTER_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: AFTER_TBOX_TNUMBER */ + case AntlrSQLLexer::AFTER_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("AFTER_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AfterTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: AFTER_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: AFTER_TSPATIAL_STBOX */ + case AntlrSQLLexer::AFTER_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("AFTER_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AfterTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: AFTER_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: BACK_STBOX_TSPATIAL */ + case AntlrSQLLexer::BACK_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("BACK_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BackStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: BACK_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: BACK_TSPATIAL_STBOX */ + case AntlrSQLLexer::BACK_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("BACK_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BackTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: BACK_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: BEFORE_STBOX_TSPATIAL */ + case AntlrSQLLexer::BEFORE_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("BEFORE_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BeforeStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: BEFORE_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: BEFORE_TBOX_TNUMBER */ + case AntlrSQLLexer::BEFORE_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("BEFORE_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BeforeTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: BEFORE_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: BEFORE_TSPATIAL_STBOX */ + case AntlrSQLLexer::BEFORE_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("BEFORE_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BeforeTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: BEFORE_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: BELOW_STBOX_TSPATIAL */ + case AntlrSQLLexer::BELOW_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("BELOW_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BelowStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: BELOW_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: BELOW_TSPATIAL_STBOX */ + case AntlrSQLLexer::BELOW_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("BELOW_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BelowTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: BELOW_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINED_STBOX_TSPATIAL */ + case AntlrSQLLexer::CONTAINED_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("CONTAINED_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainedStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINED_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINED_TBOX_TNUMBER */ + case AntlrSQLLexer::CONTAINED_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("CONTAINED_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainedTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINED_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINED_TSPATIAL_STBOX */ + case AntlrSQLLexer::CONTAINED_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("CONTAINED_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainedTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINED_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINS_STBOX_TSPATIAL */ + case AntlrSQLLexer::CONTAINS_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("CONTAINS_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainsStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINS_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINS_TBOX_TNUMBER */ + case AntlrSQLLexer::CONTAINS_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("CONTAINS_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainsTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINS_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINS_TSPATIAL_STBOX */ + case AntlrSQLLexer::CONTAINS_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("CONTAINS_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainsTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINS_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: FRONT_STBOX_TSPATIAL */ + case AntlrSQLLexer::FRONT_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("FRONT_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(FrontStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: FRONT_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: FRONT_TSPATIAL_STBOX */ + case AntlrSQLLexer::FRONT_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("FRONT_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(FrontTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: FRONT_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: LEFT_STBOX_TSPATIAL */ + case AntlrSQLLexer::LEFT_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("LEFT_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(LeftStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: LEFT_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: LEFT_TBOX_TNUMBER */ + case AntlrSQLLexer::LEFT_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("LEFT_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(LeftTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: LEFT_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: LEFT_TSPATIAL_STBOX */ + case AntlrSQLLexer::LEFT_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("LEFT_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(LeftTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: LEFT_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERABOVE_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERABOVE_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERABOVE_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OveraboveStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERABOVE_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERABOVE_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERABOVE_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERABOVE_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OveraboveTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERABOVE_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERAFTER_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERAFTER_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERAFTER_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverafterStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERAFTER_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERAFTER_TBOX_TNUMBER */ + case AntlrSQLLexer::OVERAFTER_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERAFTER_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverafterTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERAFTER_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERAFTER_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERAFTER_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERAFTER_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverafterTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERAFTER_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBACK_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERBACK_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERBACK_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbackStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBACK_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBACK_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERBACK_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERBACK_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbackTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBACK_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBEFORE_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERBEFORE_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERBEFORE_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbeforeStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBEFORE_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBEFORE_TBOX_TNUMBER */ + case AntlrSQLLexer::OVERBEFORE_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERBEFORE_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbeforeTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBEFORE_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBEFORE_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERBEFORE_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERBEFORE_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbeforeTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBEFORE_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBELOW_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERBELOW_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERBELOW_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbelowStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBELOW_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBELOW_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERBELOW_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERBELOW_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbelowTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBELOW_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERFRONT_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERFRONT_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERFRONT_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverfrontStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERFRONT_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERFRONT_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERFRONT_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERFRONT_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverfrontTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERFRONT_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLAPS_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERLAPS_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERLAPS_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverlapsStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLAPS_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLAPS_TBOX_TNUMBER */ + case AntlrSQLLexer::OVERLAPS_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERLAPS_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverlapsTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLAPS_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLAPS_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERLAPS_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERLAPS_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverlapsTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLAPS_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLEFT_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERLEFT_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERLEFT_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverleftStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLEFT_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLEFT_TBOX_TNUMBER */ + case AntlrSQLLexer::OVERLEFT_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERLEFT_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverleftTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLEFT_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLEFT_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERLEFT_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERLEFT_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverleftTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLEFT_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERRIGHT_STBOX_TSPATIAL */ + case AntlrSQLLexer::OVERRIGHT_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERRIGHT_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverrightStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERRIGHT_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: OVERRIGHT_TBOX_TNUMBER */ + case AntlrSQLLexer::OVERRIGHT_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("OVERRIGHT_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverrightTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: OVERRIGHT_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERRIGHT_TSPATIAL_STBOX */ + case AntlrSQLLexer::OVERRIGHT_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("OVERRIGHT_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverrightTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: OVERRIGHT_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: RIGHT_STBOX_TSPATIAL */ + case AntlrSQLLexer::RIGHT_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("RIGHT_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(RightStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: RIGHT_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: RIGHT_TBOX_TNUMBER */ + case AntlrSQLLexer::RIGHT_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("RIGHT_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(RightTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: RIGHT_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: RIGHT_TSPATIAL_STBOX */ + case AntlrSQLLexer::RIGHT_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("RIGHT_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(RightTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: RIGHT_TSPATIAL_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: SAME_STBOX_TSPATIAL */ + case AntlrSQLLexer::SAME_STBOX_TSPATIAL: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("SAME_STBOX_TSPATIAL requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(SameStboxTspatialLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: SAME_STBOX_TSPATIAL */ + + /* BEGIN CODEGEN PARSER GLUE: SAME_TBOX_TNUMBER */ + case AntlrSQLLexer::SAME_TBOX_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("SAME_TBOX_TNUMBER requires exactly 3 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(SameTboxTnumberLogicalFunction(a0, a1, a2)); + } + break; + /* END CODEGEN PARSER GLUE: SAME_TBOX_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: SAME_TSPATIAL_STBOX */ + case AntlrSQLLexer::SAME_TSPATIAL_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("SAME_TSPATIAL_STBOX requires exactly 4 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a3 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a2 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(SameTspatialStboxLogicalFunction(a0, a1, a2, a3)); + } + break; + /* END CODEGEN PARSER GLUE: SAME_TSPATIAL_STBOX */ + /* BEGIN CODEGEN PARSER GLUE: TPOINT_LENGTH_WKB */ + case AntlrSQLLexer::TPOINT_LENGTH_WKB: + { + const auto argCount = context->expression().size(); + if (argCount != 1) + throw InvalidQuerySyntax("TPOINT_LENGTH_WKB requires exactly 1 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(TpointLengthWkbLogicalFunction(a0)); + } + break; + /* END CODEGEN PARSER GLUE: TPOINT_LENGTH_WKB */ + /* BEGIN CODEGEN PARSER GLUE: ABOVE_STBOX_STBOX */ + case AntlrSQLLexer::ABOVE_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("ABOVE_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AboveStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: ABOVE_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: ADJACENT_STBOX_STBOX */ + case AntlrSQLLexer::ADJACENT_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("ADJACENT_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AdjacentStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: ADJACENT_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: AFTER_STBOX_STBOX */ + case AntlrSQLLexer::AFTER_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("AFTER_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AfterStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: AFTER_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: BACK_STBOX_STBOX */ + case AntlrSQLLexer::BACK_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("BACK_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BackStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: BACK_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: BEFORE_STBOX_STBOX */ + case AntlrSQLLexer::BEFORE_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("BEFORE_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BeforeStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: BEFORE_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: BELOW_STBOX_STBOX */ + case AntlrSQLLexer::BELOW_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("BELOW_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BelowStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: BELOW_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINED_STBOX_STBOX */ + case AntlrSQLLexer::CONTAINED_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("CONTAINED_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainedStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINED_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINS_STBOX_STBOX */ + case AntlrSQLLexer::CONTAINS_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("CONTAINS_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainsStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINS_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: FRONT_STBOX_STBOX */ + case AntlrSQLLexer::FRONT_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("FRONT_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(FrontStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: FRONT_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: LEFT_STBOX_STBOX */ + case AntlrSQLLexer::LEFT_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("LEFT_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(LeftStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: LEFT_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: NAD_STBOX_STBOX */ + case AntlrSQLLexer::NAD_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("NAD_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(NadStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: NAD_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERABOVE_STBOX_STBOX */ + case AntlrSQLLexer::OVERABOVE_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERABOVE_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OveraboveStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERABOVE_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERAFTER_STBOX_STBOX */ + case AntlrSQLLexer::OVERAFTER_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERAFTER_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverafterStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERAFTER_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBACK_STBOX_STBOX */ + case AntlrSQLLexer::OVERBACK_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERBACK_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbackStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBACK_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBEFORE_STBOX_STBOX */ + case AntlrSQLLexer::OVERBEFORE_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERBEFORE_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbeforeStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBEFORE_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBELOW_STBOX_STBOX */ + case AntlrSQLLexer::OVERBELOW_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERBELOW_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbelowStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBELOW_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERFRONT_STBOX_STBOX */ + case AntlrSQLLexer::OVERFRONT_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERFRONT_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverfrontStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERFRONT_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLAPS_STBOX_STBOX */ + case AntlrSQLLexer::OVERLAPS_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERLAPS_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverlapsStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLAPS_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLEFT_STBOX_STBOX */ + case AntlrSQLLexer::OVERLEFT_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERLEFT_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverleftStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLEFT_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: OVERRIGHT_STBOX_STBOX */ + case AntlrSQLLexer::OVERRIGHT_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERRIGHT_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverrightStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERRIGHT_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: RIGHT_STBOX_STBOX */ + case AntlrSQLLexer::RIGHT_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("RIGHT_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(RightStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: RIGHT_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: SAME_STBOX_STBOX */ + case AntlrSQLLexer::SAME_STBOX_STBOX: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("SAME_STBOX_STBOX requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(SameStboxStboxLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: SAME_STBOX_STBOX */ + + /* BEGIN CODEGEN PARSER GLUE: STBOX_CMP */ + case AntlrSQLLexer::STBOX_CMP: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("STBOX_CMP requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(StboxCmpLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: STBOX_CMP */ + + /* BEGIN CODEGEN PARSER GLUE: STBOX_EQ */ + case AntlrSQLLexer::STBOX_EQ: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("STBOX_EQ requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(StboxEqLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: STBOX_EQ */ + + /* BEGIN CODEGEN PARSER GLUE: STBOX_GE */ + case AntlrSQLLexer::STBOX_GE: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("STBOX_GE requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(StboxGeLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: STBOX_GE */ + + /* BEGIN CODEGEN PARSER GLUE: STBOX_GT */ + case AntlrSQLLexer::STBOX_GT: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("STBOX_GT requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(StboxGtLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: STBOX_GT */ + + /* BEGIN CODEGEN PARSER GLUE: STBOX_LE */ + case AntlrSQLLexer::STBOX_LE: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("STBOX_LE requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(StboxLeLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: STBOX_LE */ + + /* BEGIN CODEGEN PARSER GLUE: STBOX_LT */ + case AntlrSQLLexer::STBOX_LT: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("STBOX_LT requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(StboxLtLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: STBOX_LT */ + + /* BEGIN CODEGEN PARSER GLUE: STBOX_NE */ + case AntlrSQLLexer::STBOX_NE: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("STBOX_NE requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(StboxNeLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: STBOX_NE */ + /* BEGIN CODEGEN PARSER GLUE: ADJACENT_TNUMBER_TNUMBER */ + case AntlrSQLLexer::ADJACENT_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("ADJACENT_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AdjacentTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: ADJACENT_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: AFTER_TNUMBER_TNUMBER */ + case AntlrSQLLexer::AFTER_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("AFTER_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(AfterTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: AFTER_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: BEFORE_TNUMBER_TNUMBER */ + case AntlrSQLLexer::BEFORE_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("BEFORE_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(BeforeTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: BEFORE_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINED_TNUMBER_TNUMBER */ + case AntlrSQLLexer::CONTAINED_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("CONTAINED_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainedTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINED_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: CONTAINS_TNUMBER_TNUMBER */ + case AntlrSQLLexer::CONTAINS_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("CONTAINS_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(ContainsTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: CONTAINS_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: LEFT_TNUMBER_TNUMBER */ + case AntlrSQLLexer::LEFT_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("LEFT_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(LeftTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: LEFT_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERAFTER_TNUMBER_TNUMBER */ + case AntlrSQLLexer::OVERAFTER_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERAFTER_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverafterTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERAFTER_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERBEFORE_TNUMBER_TNUMBER */ + case AntlrSQLLexer::OVERBEFORE_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERBEFORE_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverbeforeTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERBEFORE_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLAPS_TNUMBER_TNUMBER */ + case AntlrSQLLexer::OVERLAPS_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERLAPS_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverlapsTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLAPS_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERLEFT_TNUMBER_TNUMBER */ + case AntlrSQLLexer::OVERLEFT_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERLEFT_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverleftTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERLEFT_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: OVERRIGHT_TNUMBER_TNUMBER */ + case AntlrSQLLexer::OVERRIGHT_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("OVERRIGHT_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(OverrightTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: OVERRIGHT_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: RIGHT_TNUMBER_TNUMBER */ + case AntlrSQLLexer::RIGHT_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("RIGHT_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(RightTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: RIGHT_TNUMBER_TNUMBER */ + + /* BEGIN CODEGEN PARSER GLUE: SAME_TNUMBER_TNUMBER */ + case AntlrSQLLexer::SAME_TNUMBER_TNUMBER: + { + const auto argCount = context->expression().size(); + if (argCount != 2) + throw InvalidQuerySyntax("SAME_TNUMBER_TNUMBER requires exactly 2 arguments, but got {}", argCount); + + while (!helpers.top().constantBuilder.empty()) + { + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + } + + auto a1 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto a0 = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back(SameTnumberTnumberLogicalFunction(a0, a1)); + } + break; + /* END CODEGEN PARSER GLUE: SAME_TNUMBER_TNUMBER */ + + + + + + + + + + + + + + + + + + + + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_INSTANTS (case-switch) */ + case AntlrSQLLexer::TEMPORAL_NUM_INSTANTS: + // Per-(window, group) count of instants in the assembled tgeo trajectory. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_NUM_INSTANTS requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_NUM_INSTANTS arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalNumInstantsAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_INSTANTS (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_SEQUENCES (case-switch) */ + case AntlrSQLLexer::TEMPORAL_NUM_SEQUENCES: + // Per-(window, group) count of sub-sequences in the assembled tgeo trajectory. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_NUM_SEQUENCES requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_NUM_SEQUENCES arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalNumSequencesAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_SEQUENCES (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_TIMESTAMPS (case-switch) */ + case AntlrSQLLexer::TEMPORAL_NUM_TIMESTAMPS: + // Per-(window, group) count of distinct timestamps in the assembled tgeo trajectory. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_NUM_TIMESTAMPS requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_NUM_TIMESTAMPS arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalNumTimestampsAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_TIMESTAMPS (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_START_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TFLOAT_START_VALUE: + // Value at the first instant of the per-(window, group) tfloat sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_START_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_START_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTFloatStartValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_START_VALUE (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_END_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TFLOAT_END_VALUE: + // Value at the last instant of the per-(window, group) tfloat sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_END_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_END_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTFloatEndValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_END_VALUE (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_MIN_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TFLOAT_MIN_VALUE: + // Minimum value across instants of the per-(window, group) tfloat sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_MIN_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_MIN_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTFloatMinValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_MIN_VALUE (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_MAX_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TFLOAT_MAX_VALUE: + // Maximum value across instants of the per-(window, group) tfloat sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_MAX_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_MAX_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTFloatMaxValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_MAX_VALUE (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TNUMBER_INTEGRAL (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TNUMBER_INTEGRAL: + // Time-weighted integral (area under the value-vs-time curve) of the per-(window, group) tfloat sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TNUMBER_INTEGRAL requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TNUMBER_INTEGRAL arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTNumberIntegralAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TNUMBER_INTEGRAL (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_START_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TINT_START_VALUE: + // Value at the first instant of the per-(window, group) tint sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TINT_START_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TINT_START_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTIntStartValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_START_VALUE (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_END_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TINT_END_VALUE: + // Value at the last instant of the per-(window, group) tint sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TINT_END_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TINT_END_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTIntEndValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_END_VALUE (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_MIN_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TINT_MIN_VALUE: + // Minimum value across instants of the per-(window, group) tint sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TINT_MIN_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TINT_MIN_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTIntMinValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_MIN_VALUE (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_MAX_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TINT_MAX_VALUE: + // Maximum value across instants of the per-(window, group) tint sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TINT_MAX_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TINT_MAX_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTIntMaxValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_MAX_VALUE (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_AVG_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TFLOAT_AVG_VALUE: + // Arithmetic mean of all instant values in the per-(window, group) tfloat sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_AVG_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_AVG_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTFloatAvgValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_AVG_VALUE (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TNUMBER_TWAVG (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TNUMBER_TWAVG: + // Time-weighted average of values across the per-(window, group) tfloat sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TNUMBER_TWAVG requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TNUMBER_TWAVG arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTNumberTwAvgAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TNUMBER_TWAVG (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_AVG_VALUE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TINT_AVG_VALUE: + // Arithmetic mean (as double) of all instant values in the per-(window, group) tint sequence. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_TINT_AVG_VALUE requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TINT_AVG_VALUE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTIntAvgValueAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_AVG_VALUE (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_START_TIMESTAMP (case-switch) */ + case AntlrSQLLexer::TEMPORAL_START_TIMESTAMP: + // TimestampTz (MEOS μs-since-2000) of the first instant in the per-(window, group) tgeo trajectory. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_START_TIMESTAMP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_START_TIMESTAMP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalStartTimestampAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_START_TIMESTAMP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_END_TIMESTAMP (case-switch) */ + case AntlrSQLLexer::TEMPORAL_END_TIMESTAMP: + // TimestampTz (MEOS μs-since-2000) of the last instant in the per-(window, group) tgeo trajectory. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_END_TIMESTAMP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_END_TIMESTAMP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalEndTimestampAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_END_TIMESTAMP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_LOWER_INC (case-switch) */ + case AntlrSQLLexer::TEMPORAL_LOWER_INC: + // True if the per-(window, group) tgeo trajectory's lower period bound is inclusive. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_LOWER_INC requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_LOWER_INC arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalLowerIncAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_LOWER_INC (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_UPPER_INC (case-switch) */ + case AntlrSQLLexer::TEMPORAL_UPPER_INC: + // True if the per-(window, group) tgeo trajectory's upper period bound is inclusive. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_UPPER_INC requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_UPPER_INC arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalUpperIncAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_UPPER_INC (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TPOINT_IS_SIMPLE (case-switch) */ + case AntlrSQLLexer::TEMPORAL_TPOINT_IS_SIMPLE: + // True if the per-(window, group) tgeo trajectory does not self-intersect. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_TPOINT_IS_SIMPLE requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_TPOINT_IS_SIMPLE arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalTPointIsSimpleAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TPOINT_IS_SIMPLE (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TSPATIAL_EXTENT (case-switch) */ + case AntlrSQLLexer::TSPATIAL_EXTENT: + // Windowed spatiotemporal extent (STBox) over a tgeo trajectory via tspatial_extent_transfn. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TSPATIAL_EXTENT requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TSPATIAL_EXTENT arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TspatialExtentAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TSPATIAL_EXTENT (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_EXTENT (case-switch) */ + case AntlrSQLLexer::TNUMBER_EXTENT: + // Windowed numeric-temporal extent (TBox) over a tnumber sequence via tnumber_extent_transfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TNUMBER_EXTENT requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TNUMBER_EXTENT arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TnumberExtentAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TNUMBER_EXTENT (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: FLOAT_EXTENT (case-switch) */ + case AntlrSQLLexer::FLOAT_EXTENT: + // Windowed value extent (FLOATSPAN) over a tfloat stream via float_extent_transfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("FLOAT_EXTENT requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("FLOAT_EXTENT arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + FloatExtentAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: FLOAT_EXTENT (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: INT_EXTENT (case-switch) */ + case AntlrSQLLexer::INT_EXTENT: + // Windowed value extent (INTSPAN) over a tint stream via int_extent_transfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("INT_EXTENT requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("INT_EXTENT arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + IntExtentAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: INT_EXTENT (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: BIGINT_EXTENT (case-switch) */ + case AntlrSQLLexer::BIGINT_EXTENT: + // Windowed value extent (BIGINTSPAN) over a tbigint stream via bigint_extent_transfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("BIGINT_EXTENT requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("BIGINT_EXTENT arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + BigintExtentAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: BIGINT_EXTENT (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TIMESTAMPTZ_EXTENT (case-switch) */ + case AntlrSQLLexer::TIMESTAMPTZ_EXTENT: + // Windowed time extent (TSTZSPAN) over an event-time field via timestamptz_extent_transfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TIMESTAMPTZ_EXTENT requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TIMESTAMPTZ_EXTENT arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TimestamptzExtentAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TIMESTAMPTZ_EXTENT (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: FLOAT_UNION (case-switch) */ + case AntlrSQLLexer::FLOAT_UNION: + // Windowed value union (FLOATSET) over a tfloat stream via float_union_transfn + set_union_finalfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("FLOAT_UNION requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("FLOAT_UNION arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + FloatUnionAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: FLOAT_UNION (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: INT_UNION (case-switch) */ + case AntlrSQLLexer::INT_UNION: + // Windowed value union (INTSET) over a tint stream via int_union_transfn + set_union_finalfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("INT_UNION requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("INT_UNION arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + IntUnionAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: INT_UNION (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: BIGINT_UNION (case-switch) */ + case AntlrSQLLexer::BIGINT_UNION: + // Windowed value union (BIGINTSET) over a tbigint stream via bigint_union_transfn + set_union_finalfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("BIGINT_UNION requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("BIGINT_UNION arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + BigintUnionAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: BIGINT_UNION (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TIMESTAMPTZ_UNION (case-switch) */ + case AntlrSQLLexer::TIMESTAMPTZ_UNION: + // Windowed time union (TSTZSET) over an event-time field via timestamptz_union_transfn + set_union_finalfn. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TIMESTAMPTZ_UNION requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TIMESTAMPTZ_UNION arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TimestamptzUnionAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TIMESTAMPTZ_UNION (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TRAJECTORY_WKB (case-switch) */ + case AntlrSQLLexer::TRAJECTORY_WKB: + // Windowed mini-trip trajectory materialized as hex-WKB — the value the MEOS function library composes over. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TRAJECTORY_WKB requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TRAJECTORY_WKB arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TrajectoryWkbAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TRAJECTORY_WKB (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TLENGTH_EXP (case-switch) */ + case AntlrSQLLexer::TLENGTH_EXP: + // Windowed trajectory length over an expandable Temporal* grown by appendInstant — the MEOS-native streaming aggregation (no string build, no WKB). + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TLENGTH_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TLENGTH_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TLengthExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TLENGTH_EXP (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TGEO_CENTROID_EXP (case-switch) */ + case AntlrSQLLexer::TGEO_CENTROID_EXP: + // Windowed centroid trajectory via tgeo_centroid over the expandable mini-trip, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TGEO_CENTROID_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TGEO_CENTROID_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TgeoCentroidExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TGEO_CENTROID_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_AZIMUTH_EXP (case-switch) */ + case AntlrSQLLexer::TPOINT_AZIMUTH_EXP: + // Windowed azimuth (tfloat) via tpoint_azimuth over the expandable mini-trip, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TPOINT_AZIMUTH_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TPOINT_AZIMUTH_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TpointAzimuthExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TPOINT_AZIMUTH_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_ANGULAR_DIFFERENCE_EXP (case-switch) */ + case AntlrSQLLexer::TPOINT_ANGULAR_DIFFERENCE_EXP: + // Windowed angular difference via tpoint_angular_difference over the expandable mini-trip, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TPOINT_ANGULAR_DIFFERENCE_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TPOINT_ANGULAR_DIFFERENCE_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TpointAngularDifferenceExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TPOINT_ANGULAR_DIFFERENCE_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TGEOMPOINT_TO_TGEOMETRY_EXP (case-switch) */ + case AntlrSQLLexer::TGEOMPOINT_TO_TGEOMETRY_EXP: + // Windowed tgeompoint->tgeometry conversion over the expandable mini-trip, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TGEOMPOINT_TO_TGEOMETRY_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TGEOMPOINT_TO_TGEOMETRY_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TgeompointToTgeometryExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TGEOMPOINT_TO_TGEOMETRY_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_COPY_EXP (case-switch) */ + case AntlrSQLLexer::TEMPORAL_COPY_EXP: + // Windowed temporal_copy over the expandable mini-trip, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TEMPORAL_COPY_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_COPY_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalCopyExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_COPY_EXP (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_ABS_EXP (case-switch) */ + case AntlrSQLLexer::TNUMBER_ABS_EXP: + // Windowed tnumber_abs over the expandable tfloat mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TNUMBER_ABS_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TNUMBER_ABS_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TnumberAbsExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TNUMBER_ABS_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_DELTA_VALUE_EXP (case-switch) */ + case AntlrSQLLexer::TNUMBER_DELTA_VALUE_EXP: + // Windowed tnumber_delta_value over the expandable tfloat mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TNUMBER_DELTA_VALUE_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TNUMBER_DELTA_VALUE_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TnumberDeltaValueExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TNUMBER_DELTA_VALUE_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_ANGULAR_DIFFERENCE_EXP (case-switch) */ + case AntlrSQLLexer::TNUMBER_ANGULAR_DIFFERENCE_EXP: + // Windowed tnumber_angular_difference over the expandable tfloat mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TNUMBER_ANGULAR_DIFFERENCE_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TNUMBER_ANGULAR_DIFFERENCE_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TnumberAngularDifferenceExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TNUMBER_ANGULAR_DIFFERENCE_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_DERIVATIVE_EXP (case-switch) */ + case AntlrSQLLexer::TEMPORAL_DERIVATIVE_EXP: + // Windowed temporal_derivative over the expandable tfloat mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_DERIVATIVE_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_DERIVATIVE_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalDerivativeExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_DERIVATIVE_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_AT_MAX_EXP (case-switch) */ + case AntlrSQLLexer::TEMPORAL_AT_MAX_EXP: + // Windowed temporal_at_max over the expandable tfloat mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_AT_MAX_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_AT_MAX_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalAtMaxExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_AT_MAX_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_AT_MIN_EXP (case-switch) */ + case AntlrSQLLexer::TEMPORAL_AT_MIN_EXP: + // Windowed temporal_at_min over the expandable tfloat mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_AT_MIN_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_AT_MIN_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalAtMinExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_AT_MIN_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_MINUS_MAX_EXP (case-switch) */ + case AntlrSQLLexer::TEMPORAL_MINUS_MAX_EXP: + // Windowed temporal_minus_max over the expandable tfloat mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_MINUS_MAX_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_MINUS_MAX_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalMinusMaxExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_MINUS_MAX_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_MINUS_MIN_EXP (case-switch) */ + case AntlrSQLLexer::TEMPORAL_MINUS_MIN_EXP: + // Windowed temporal_minus_min over the expandable tfloat mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TEMPORAL_MINUS_MIN_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TEMPORAL_MINUS_MIN_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TemporalMinusMinExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_MINUS_MIN_EXP (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TNPOINT_CUMULATIVE_LENGTH_EXP (case-switch) */ + case AntlrSQLLexer::TNPOINT_CUMULATIVE_LENGTH_EXP: + // Windowed tnpoint_cumulative_length over the expandable tnpoint mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TNPOINT_CUMULATIVE_LENGTH_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TNPOINT_CUMULATIVE_LENGTH_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TnpointCumulativeLengthExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TNPOINT_CUMULATIVE_LENGTH_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNPOINT_SPEED_EXP (case-switch) */ + case AntlrSQLLexer::TNPOINT_SPEED_EXP: + // Windowed tnpoint_speed over the expandable tnpoint mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TNPOINT_SPEED_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TNPOINT_SPEED_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TnpointSpeedExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TNPOINT_SPEED_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNPOINT_TO_TGEOMPOINT_EXP (case-switch) */ + case AntlrSQLLexer::TNPOINT_TO_TGEOMPOINT_EXP: + // Windowed tnpoint_to_tgeompoint over the expandable tnpoint mini-series, emitted as hex-WKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TNPOINT_TO_TGEOMPOINT_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TNPOINT_TO_TGEOMPOINT_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TnpointToTgeompointExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TNPOINT_TO_TGEOMPOINT_EXP (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_CUMULATIVE_LENGTH_EXP (case-switch) */ + case AntlrSQLLexer::TPOINT_CUMULATIVE_LENGTH_EXP: + // Windowed tgeompoint mini-trip grown by appendInstant; tpoint_cumulative_length emits the running planar length as a tfloat (hex-WKB). + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TPOINT_CUMULATIVE_LENGTH_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TPOINT_CUMULATIVE_LENGTH_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TpointCumulativeLengthExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TPOINT_CUMULATIVE_LENGTH_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_SPEED_EXP (case-switch) */ + case AntlrSQLLexer::TPOINT_SPEED_EXP: + // Windowed tgeompoint mini-trip; tpoint_speed differentiates it into a speed tfloat (hex-WKB). + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TPOINT_SPEED_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TPOINT_SPEED_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TpointSpeedExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TPOINT_SPEED_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_GET_X_EXP (case-switch) */ + case AntlrSQLLexer::TPOINT_GET_X_EXP: + // Windowed tgeompoint mini-trip; tpoint_get_x projects the X coordinate as a tfloat (hex-WKB). + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TPOINT_GET_X_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TPOINT_GET_X_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TpointGetXExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TPOINT_GET_X_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_GET_Y_EXP (case-switch) */ + case AntlrSQLLexer::TPOINT_GET_Y_EXP: + // Windowed tgeompoint mini-trip; tpoint_get_y projects the Y coordinate as a tfloat (hex-WKB). + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TPOINT_GET_Y_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TPOINT_GET_Y_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TpointGetYExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TPOINT_GET_Y_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_TREND_EXP (case-switch) */ + case AntlrSQLLexer::TNUMBER_TREND_EXP: + // Windowed tnumber mini-series; tnumber_trend emits the rising/falling trend as a tint (hex-WKB). + if (helpers.top().functionBuilder.size() != 2) { + throw InvalidQuerySyntax("TNUMBER_TREND_EXP requires exactly two arguments (value, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TNUMBER_TREND_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TnumberTrendExpAggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TNUMBER_TREND_EXP (case-switch) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TGEO_START_VALUE_EXP (case-switch) */ + case AntlrSQLLexer::TGEO_START_VALUE_EXP: + // Windowed tgeompoint mini-trip; tgeo_start_value emits the first point geometry as hex-EWKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TGEO_START_VALUE_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TGEO_START_VALUE_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TgeoStartValueExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TGEO_START_VALUE_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TGEO_END_VALUE_EXP (case-switch) */ + case AntlrSQLLexer::TGEO_END_VALUE_EXP: + // Windowed tgeompoint mini-trip; tgeo_end_value emits the last point geometry as hex-EWKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TGEO_END_VALUE_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TGEO_END_VALUE_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TgeoEndValueExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TGEO_END_VALUE_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TGEO_CONVEX_HULL_EXP (case-switch) */ + case AntlrSQLLexer::TGEO_CONVEX_HULL_EXP: + // Windowed tgeompoint mini-trip; tgeo_convex_hull emits the trajectory convex hull as hex-EWKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TGEO_CONVEX_HULL_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TGEO_CONVEX_HULL_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TgeoConvexHullExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TGEO_CONVEX_HULL_EXP (case-switch) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_TWCENTROID_EXP (case-switch) */ + case AntlrSQLLexer::TPOINT_TWCENTROID_EXP: + // Windowed tgeompoint mini-trip; tpoint_twcentroid emits the time-weighted centroid point as hex-EWKB. + if (helpers.top().functionBuilder.size() != 3) { + throw InvalidQuerySyntax("TPOINT_TWCENTROID_EXP requires exactly three arguments (longitude, latitude, timestamp), but got {}", helpers.top().functionBuilder.size()); + } + { + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) { + throw InvalidQuerySyntax("TPOINT_TWCENTROID_EXP arguments must be field references"); + } + + helpers.top().windowAggs.push_back( + TpointTwcentroidExpAggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + } + break; + /* END CODEGEN AGGREGATION GLUE: TPOINT_TWCENTROID_EXP (case-switch) */ + + + + + + + + + + + + + + + + + + default: + /// Check if the function is a constructor for a datatype + if (const auto dataType = DataTypeProvider::tryProvideDataType(funcName); dataType.has_value()) + { + if (helpers.top().constantBuilder.empty()) + { + throw InvalidQuerySyntax("Expected constant, got nothing at {}", context->getText()); + } + helpers.top().hasUnnamedAggregation = false; + auto value = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + auto constFunctionItem = ConstantValueLogicalFunction(*dataType, std::move(value)); + helpers.top().functionBuilder.emplace_back(constFunctionItem); + } + else if (funcName == "VAR") + { + if (helpers.top().functionBuilder.empty()) + { + throw InvalidQuerySyntax("Aggregation requires argument at {}", context->getText()); + } + const auto& lastArg = helpers.top().functionBuilder.back().get(); + helpers.top().windowAggs.push_back(std::make_shared(lastArg)); + } + else if (funcName == "TEMPORAL_SEQUENCE") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_SEQUENCE requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalSequenceAggregationLogicalFunctionV2::create(lon, lat, ts)); + } + else if (funcName == "TEMPORAL_LENGTH") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_LENGTH requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalLengthAggregationLogicalFunction::create(lon, lat, ts)); + } + else if (funcName == "PAIR_MEETING") + { + // Five-arg shape: 4 FieldAccess + 1 numeric constant (dMeet metres). + if (helpers.top().constantBuilder.empty()) + { + throw InvalidQuerySyntax( + "PAIR_MEETING requires a numeric constant fifth argument (dMeet metres) at {}", + context->getText()); + } + auto dMeetString = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + double dMeetMetres; + try { dMeetMetres = std::stod(dMeetString); } + catch (const std::exception&) { + throw InvalidQuerySyntax( + "PAIR_MEETING fifth argument must be a numeric constant (dMeet metres), got `{}` at {}", + dMeetString, context->getText()); + } + if (helpers.top().functionBuilder.size() < 4) + { + throw InvalidQuerySyntax( + "PAIR_MEETING requires four field args + 1 constant at {}", context->getText()); + } + const auto vid = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(PairMeetingAggregationLogicalFunction::create(lon, lat, ts, vid, dMeetMetres)); + } + else if (funcName == "CROSS_DISTANCE") + { + // Six-arg shape: 4 FieldAccess + 2 numeric constants (vidA, vidB). + if (helpers.top().constantBuilder.size() < 2) + { + throw InvalidQuerySyntax( + "CROSS_DISTANCE requires two numeric constant arguments (vidA, vidB) at {}", + context->getText()); + } + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_INSTANTS (funcName chain) */ + else if (funcName == "TEMPORAL_NUM_INSTANTS") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_NUM_INSTANTS requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalNumInstantsAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_INSTANTS (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_SEQUENCES (funcName chain) */ + else if (funcName == "TEMPORAL_NUM_SEQUENCES") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_NUM_SEQUENCES requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalNumSequencesAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_SEQUENCES (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_TIMESTAMPS (funcName chain) */ + else if (funcName == "TEMPORAL_NUM_TIMESTAMPS") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_NUM_TIMESTAMPS requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalNumTimestampsAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_NUM_TIMESTAMPS (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_START_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TFLOAT_START_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_START_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTFloatStartValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_START_VALUE (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_END_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TFLOAT_END_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_END_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTFloatEndValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_END_VALUE (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_MIN_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TFLOAT_MIN_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_MIN_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTFloatMinValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_MIN_VALUE (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_MAX_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TFLOAT_MAX_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_MAX_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTFloatMaxValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_MAX_VALUE (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TNUMBER_INTEGRAL (funcName chain) */ + else if (funcName == "TEMPORAL_TNUMBER_INTEGRAL") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TNUMBER_INTEGRAL requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTNumberIntegralAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TNUMBER_INTEGRAL (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_START_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TINT_START_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TINT_START_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTIntStartValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_START_VALUE (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_END_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TINT_END_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TINT_END_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTIntEndValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_END_VALUE (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_MIN_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TINT_MIN_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TINT_MIN_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTIntMinValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_MIN_VALUE (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_MAX_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TINT_MAX_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TINT_MAX_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTIntMaxValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_MAX_VALUE (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_AVG_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TFLOAT_AVG_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TFLOAT_AVG_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTFloatAvgValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TFLOAT_AVG_VALUE (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TNUMBER_TWAVG (funcName chain) */ + else if (funcName == "TEMPORAL_TNUMBER_TWAVG") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TNUMBER_TWAVG requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTNumberTwAvgAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TNUMBER_TWAVG (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_AVG_VALUE (funcName chain) */ + else if (funcName == "TEMPORAL_TINT_AVG_VALUE") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_TINT_AVG_VALUE requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTIntAvgValueAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TINT_AVG_VALUE (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_START_TIMESTAMP (funcName chain) */ + else if (funcName == "TEMPORAL_START_TIMESTAMP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_START_TIMESTAMP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalStartTimestampAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_START_TIMESTAMP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_END_TIMESTAMP (funcName chain) */ + else if (funcName == "TEMPORAL_END_TIMESTAMP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_END_TIMESTAMP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalEndTimestampAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_END_TIMESTAMP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_LOWER_INC (funcName chain) */ + else if (funcName == "TEMPORAL_LOWER_INC") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_LOWER_INC requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalLowerIncAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_LOWER_INC (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_UPPER_INC (funcName chain) */ + else if (funcName == "TEMPORAL_UPPER_INC") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_UPPER_INC requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalUpperIncAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_UPPER_INC (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_TPOINT_IS_SIMPLE (funcName chain) */ + else if (funcName == "TEMPORAL_TPOINT_IS_SIMPLE") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_TPOINT_IS_SIMPLE requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalTPointIsSimpleAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_TPOINT_IS_SIMPLE (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TSPATIAL_EXTENT (funcName chain) */ + else if (funcName == "TSPATIAL_EXTENT") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TSPATIAL_EXTENT requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TspatialExtentAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TSPATIAL_EXTENT (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_EXTENT (funcName chain) */ + else if (funcName == "TNUMBER_EXTENT") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TNUMBER_EXTENT requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TnumberExtentAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TNUMBER_EXTENT (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: FLOAT_EXTENT (funcName chain) */ + else if (funcName == "FLOAT_EXTENT") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("FLOAT_EXTENT requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(FloatExtentAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: FLOAT_EXTENT (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: INT_EXTENT (funcName chain) */ + else if (funcName == "INT_EXTENT") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("INT_EXTENT requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(IntExtentAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: INT_EXTENT (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: BIGINT_EXTENT (funcName chain) */ + else if (funcName == "BIGINT_EXTENT") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("BIGINT_EXTENT requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(BigintExtentAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: BIGINT_EXTENT (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TIMESTAMPTZ_EXTENT (funcName chain) */ + else if (funcName == "TIMESTAMPTZ_EXTENT") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TIMESTAMPTZ_EXTENT requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TimestamptzExtentAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TIMESTAMPTZ_EXTENT (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: FLOAT_UNION (funcName chain) */ + else if (funcName == "FLOAT_UNION") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("FLOAT_UNION requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(FloatUnionAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: FLOAT_UNION (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: INT_UNION (funcName chain) */ + else if (funcName == "INT_UNION") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("INT_UNION requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(IntUnionAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: INT_UNION (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: BIGINT_UNION (funcName chain) */ + else if (funcName == "BIGINT_UNION") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("BIGINT_UNION requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(BigintUnionAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: BIGINT_UNION (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TIMESTAMPTZ_UNION (funcName chain) */ + else if (funcName == "TIMESTAMPTZ_UNION") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TIMESTAMPTZ_UNION requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TimestamptzUnionAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TIMESTAMPTZ_UNION (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TRAJECTORY_WKB (funcName chain) */ + else if (funcName == "TRAJECTORY_WKB") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TRAJECTORY_WKB requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TrajectoryWkbAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TRAJECTORY_WKB (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TLENGTH_EXP (funcName chain) */ + else if (funcName == "TLENGTH_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TLENGTH_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TLengthExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TLENGTH_EXP (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TGEO_CENTROID_EXP (funcName chain) */ + else if (funcName == "TGEO_CENTROID_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TGEO_CENTROID_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TgeoCentroidExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TGEO_CENTROID_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_AZIMUTH_EXP (funcName chain) */ + else if (funcName == "TPOINT_AZIMUTH_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TPOINT_AZIMUTH_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TpointAzimuthExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TPOINT_AZIMUTH_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_ANGULAR_DIFFERENCE_EXP (funcName chain) */ + else if (funcName == "TPOINT_ANGULAR_DIFFERENCE_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TPOINT_ANGULAR_DIFFERENCE_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TpointAngularDifferenceExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TPOINT_ANGULAR_DIFFERENCE_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TGEOMPOINT_TO_TGEOMETRY_EXP (funcName chain) */ + else if (funcName == "TGEOMPOINT_TO_TGEOMETRY_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TGEOMPOINT_TO_TGEOMETRY_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TgeompointToTgeometryExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TGEOMPOINT_TO_TGEOMETRY_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_COPY_EXP (funcName chain) */ + else if (funcName == "TEMPORAL_COPY_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TEMPORAL_COPY_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalCopyExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_COPY_EXP (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_ABS_EXP (funcName chain) */ + else if (funcName == "TNUMBER_ABS_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TNUMBER_ABS_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TnumberAbsExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TNUMBER_ABS_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_DELTA_VALUE_EXP (funcName chain) */ + else if (funcName == "TNUMBER_DELTA_VALUE_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TNUMBER_DELTA_VALUE_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TnumberDeltaValueExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TNUMBER_DELTA_VALUE_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_ANGULAR_DIFFERENCE_EXP (funcName chain) */ + else if (funcName == "TNUMBER_ANGULAR_DIFFERENCE_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TNUMBER_ANGULAR_DIFFERENCE_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TnumberAngularDifferenceExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TNUMBER_ANGULAR_DIFFERENCE_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_DERIVATIVE_EXP (funcName chain) */ + else if (funcName == "TEMPORAL_DERIVATIVE_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_DERIVATIVE_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalDerivativeExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_DERIVATIVE_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_AT_MAX_EXP (funcName chain) */ + else if (funcName == "TEMPORAL_AT_MAX_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_AT_MAX_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalAtMaxExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_AT_MAX_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_AT_MIN_EXP (funcName chain) */ + else if (funcName == "TEMPORAL_AT_MIN_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_AT_MIN_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalAtMinExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_AT_MIN_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_MINUS_MAX_EXP (funcName chain) */ + else if (funcName == "TEMPORAL_MINUS_MAX_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_MINUS_MAX_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalMinusMaxExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_MINUS_MAX_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TEMPORAL_MINUS_MIN_EXP (funcName chain) */ + else if (funcName == "TEMPORAL_MINUS_MIN_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TEMPORAL_MINUS_MIN_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TemporalMinusMinExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TEMPORAL_MINUS_MIN_EXP (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TNPOINT_CUMULATIVE_LENGTH_EXP (funcName chain) */ + else if (funcName == "TNPOINT_CUMULATIVE_LENGTH_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TNPOINT_CUMULATIVE_LENGTH_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TnpointCumulativeLengthExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TNPOINT_CUMULATIVE_LENGTH_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNPOINT_SPEED_EXP (funcName chain) */ + else if (funcName == "TNPOINT_SPEED_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TNPOINT_SPEED_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TnpointSpeedExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TNPOINT_SPEED_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNPOINT_TO_TGEOMPOINT_EXP (funcName chain) */ + else if (funcName == "TNPOINT_TO_TGEOMPOINT_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TNPOINT_TO_TGEOMPOINT_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TnpointToTgeompointExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TNPOINT_TO_TGEOMPOINT_EXP (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_CUMULATIVE_LENGTH_EXP (funcName chain) */ + else if (funcName == "TPOINT_CUMULATIVE_LENGTH_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TPOINT_CUMULATIVE_LENGTH_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TpointCumulativeLengthExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TPOINT_CUMULATIVE_LENGTH_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_SPEED_EXP (funcName chain) */ + else if (funcName == "TPOINT_SPEED_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TPOINT_SPEED_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TpointSpeedExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TPOINT_SPEED_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_GET_X_EXP (funcName chain) */ + else if (funcName == "TPOINT_GET_X_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TPOINT_GET_X_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TpointGetXExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TPOINT_GET_X_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_GET_Y_EXP (funcName chain) */ + else if (funcName == "TPOINT_GET_Y_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TPOINT_GET_Y_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TpointGetYExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TPOINT_GET_Y_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TNUMBER_TREND_EXP (funcName chain) */ + else if (funcName == "TNUMBER_TREND_EXP") + { + if (helpers.top().functionBuilder.size() < 2) + { + throw InvalidQuerySyntax("TNUMBER_TREND_EXP requires two arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TnumberTrendExpAggregationLogicalFunction::create(value, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TNUMBER_TREND_EXP (funcName chain) */ + /* BEGIN CODEGEN AGGREGATION GLUE: TGEO_START_VALUE_EXP (funcName chain) */ + else if (funcName == "TGEO_START_VALUE_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TGEO_START_VALUE_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TgeoStartValueExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TGEO_START_VALUE_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TGEO_END_VALUE_EXP (funcName chain) */ + else if (funcName == "TGEO_END_VALUE_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TGEO_END_VALUE_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TgeoEndValueExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TGEO_END_VALUE_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TGEO_CONVEX_HULL_EXP (funcName chain) */ + else if (funcName == "TGEO_CONVEX_HULL_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TGEO_CONVEX_HULL_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TgeoConvexHullExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TGEO_CONVEX_HULL_EXP (funcName chain) */ + + /* BEGIN CODEGEN AGGREGATION GLUE: TPOINT_TWCENTROID_EXP (funcName chain) */ + else if (funcName == "TPOINT_TWCENTROID_EXP") + { + if (helpers.top().functionBuilder.size() < 3) + { + throw InvalidQuerySyntax("TPOINT_TWCENTROID_EXP requires three arguments at {}", context->getText()); + } + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(TpointTwcentroidExpAggregationLogicalFunction::create(lon, lat, ts)); + } + /* END CODEGEN AGGREGATION GLUE: TPOINT_TWCENTROID_EXP (funcName chain) */ + + + + + + + + + + + + + auto vidBString = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + auto vidAString = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + uint64_t vidA, vidB; + try { + vidA = std::stoull(vidAString); + vidB = std::stoull(vidBString); + } catch (const std::exception&) { + throw InvalidQuerySyntax( + "CROSS_DISTANCE constant arguments must be unsigned integers (vidA, vidB), got `{}` and `{}` at {}", + vidAString, vidBString, context->getText()); + } + if (helpers.top().functionBuilder.size() < 4) + { + throw InvalidQuerySyntax( + "CROSS_DISTANCE requires four field args + 2 constants at {}", context->getText()); + } + const auto vid = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back(CrossDistanceAggregationLogicalFunction::create(lon, lat, ts, vid, vidA, vidB)); } else if (auto logicalFunction = LogicalFunctionProvider::tryProvide(funcName, helpers.top().functionBuilder)) { diff --git a/nes-systests/function/meos/adwithin_tgeo_geo.test b/nes-systests/function/meos/adwithin_tgeo_geo.test new file mode 100644 index 0000000000..046dfe003f --- /dev/null +++ b/nes-systests/function/meos/adwithin_tgeo_geo.test @@ -0,0 +1,13 @@ +# name: MEOS_TemporalADWithinGeometry +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, ADWithin] +CREATE LOGICAL SOURCE adw(id UINT32, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR adw TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +2|4.1000|50.8000|1609459200 + +CREATE SINK adw_out(adw.id UINT32, within INT32) TYPE File; +SELECT id, TEMPORAL_ADWITHIN_GEOMETRY(lon, lat, timestamp, 'SRID=4326;POINT(4.3658 50.6456)', FLOAT64(0.2)) AS within FROM adw INTO adw_out; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/at_geometry.test b/nes-systests/function/meos/at_geometry.test new file mode 100644 index 0000000000..fb72aab629 --- /dev/null +++ b/nes-systests/function/meos/at_geometry.test @@ -0,0 +1,18 @@ +# name: function/spatiotemporal/MEOS_AtGeometry_Restriction.test +# description: Per-event spatial restriction of a single-instant tgeompoint by a static polygon. Returns 1 if the point survives the at-restriction (lies inside the geom), 0 if clipped. Exercises the new one-tgeo-restriction codegen template (W6). +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Restriction, AtGeometry, Codegen] + +CREATE LOGICAL SOURCE at_geom_tests(id UINT32, lon FLOAT64, lat FLOAT64, timestamp UINT64, polygon_wkt VARSIZED); +CREATE PHYSICAL SOURCE FOR at_geom_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.5|50.5|1609459200|'SRID=4326;POLYGON((4.0 50.0, 5.0 50.0, 5.0 51.0, 4.0 51.0, 4.0 50.0))' +2|6.0|52.0|1609459260|'SRID=4326;POLYGON((4.0 50.0, 5.0 50.0, 5.0 51.0, 4.0 51.0, 4.0 50.0))' + +CREATE SINK at_geom_results(at_geom_tests.id UINT32, inside INT32) TYPE File; +SELECT id, + TEMPORAL_AT_GEOMETRY(lon, lat, timestamp, polygon_wkt) AS inside +FROM at_geom_tests +INTO at_geom_results; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/bigint_extent.test b/nes-systests/function/meos/bigint_extent.test new file mode 100644 index 0000000000..e8b437af05 --- /dev/null +++ b/nes-systests/function/meos/bigint_extent.test @@ -0,0 +1,14 @@ +# name: MEOS_BigintExtent_Aggregation +# description: Windowed BIGINT_EXTENT — value extent (BIGINTSPAN) over a tbigint stream via bigint_extent_transfn (W28 scalar-fold box-output aggregation). +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE be(vehicle_id UINT64, value INT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR be TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|1200000000|1609459200 +1|1800000000|1609459201 +1|900000000|1609459202 + +CREATE SINK be_out(be.vehicle_id UINT64, be.extent VARSIZED) TYPE File; +SELECT vehicle_id, BIGINT_EXTENT(value, timestamp) AS extent FROM be GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO be_out; +---- +1,[900000000, 1800000001) diff --git a/nes-systests/function/meos/bigint_union.test b/nes-systests/function/meos/bigint_union.test new file mode 100644 index 0000000000..e32f1a0751 --- /dev/null +++ b/nes-systests/function/meos/bigint_union.test @@ -0,0 +1,14 @@ +# name: MEOS_BigintUnion_Aggregation +# description: Windowed BIGINT_UNION — value union (BIGINTSET, deduped+sorted) over a tbigint stream via bigint_union_transfn + set_union_finalfn (W30 set-collect aggregation). +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE bu(vehicle_id UINT64, value INT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR bu TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|1200000000|1609459200 +1|1800000000|1609459201 +1|900000000|1609459202 + +CREATE SINK bu_out(bu.vehicle_id UINT64, bu.vals VARSIZED) TYPE File; +SELECT vehicle_id, BIGINT_UNION(value, timestamp) AS vals FROM bu GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO bu_out; +---- +1,{900000000, 1200000000, 1800000000} diff --git a/nes-systests/function/meos/econtains_tcbuffer_cbuffer.test b/nes-systests/function/meos/econtains_tcbuffer_cbuffer.test new file mode 100644 index 0000000000..9db2987bec --- /dev/null +++ b/nes-systests/function/meos/econtains_tcbuffer_cbuffer.test @@ -0,0 +1,18 @@ +# name: function/spatiotemporal/MEOS_TemporalEContainsTCbufferCbuffer.test +# description: Per-event ever-contains between a single-instant tcbuffer (lon, lat, radius, ts) and a static Cbuffer literal. Exercises the W11 codegen shape — 5-arg lift with second-arg parsed via cbuffer_in() instead of the geometry parser used in W10. +# groups: [Function, MEOS, SpatioTemporal, TCbuffer, EContains, Codegen] + +CREATE LOGICAL SOURCE tcbuf_cbuf_tests(id UINT32, lon FLOAT64, lat FLOAT64, radius FLOAT64, timestamp UINT64, cbuffer_literal VARSIZED); +CREATE PHYSICAL SOURCE FOR tcbuf_cbuf_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|10.0|1609459200|'Cbuffer(Point(4.3658 50.6456),1.0)' +2|4.3658|50.6456|0.0001|1609459200|'Cbuffer(Point(4.4000 50.7000),0.0001)' + +CREATE SINK tcbuf_cbuf_results(tcbuf_cbuf_tests.id UINT32, contains INT32) TYPE File; +SELECT id, + TEMPORAL_ECONTAINS_TCBUFFER_CBUFFER(lon, lat, radius, timestamp, cbuffer_literal) AS contains +FROM tcbuf_cbuf_tests +INTO tcbuf_cbuf_results; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/econtains_tcbuffer_geo.test b/nes-systests/function/meos/econtains_tcbuffer_geo.test new file mode 100644 index 0000000000..eb1abe35ba --- /dev/null +++ b/nes-systests/function/meos/econtains_tcbuffer_geo.test @@ -0,0 +1,14 @@ +# name: MEOS_EContains_TCbuffer_Geo +# description: TEMPORAL_ECONTAINS_TCBUFFER: single-instant tcbuffer (lon,lat,radius) contains a static geometry constant. +# groups: [Function, MEOS, SpatioTemporal, TCbuffer, EContains] +CREATE LOGICAL SOURCE ecb(id UINT32, lon FLOAT64, lat FLOAT64, radius FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR ecb TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1.0|1609459200 +2|10.0|10.0|0.5|1609459200 + +CREATE SINK ecb_out(ecb.id UINT32, contains INT32) TYPE File; +SELECT id, TEMPORAL_ECONTAINS_TCBUFFER(lon, lat, radius, timestamp, 'POINT(4.3658 50.6456)') AS contains FROM ecb INTO ecb_out; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/econtains_tpose_geo.test b/nes-systests/function/meos/econtains_tpose_geo.test new file mode 100644 index 0000000000..8724b5df88 --- /dev/null +++ b/nes-systests/function/meos/econtains_tpose_geo.test @@ -0,0 +1,14 @@ +# name: MEOS_EContains_TPose_Geo +# description: TEMPORAL_ECONTAINS_TPOSE_GEOMETRY: single-instant tpose (x,y,theta) lifted to a tgeompoint contains a static geometry constant (W14). +# groups: [Function, MEOS, SpatioTemporal, TPose, EContains] +CREATE LOGICAL SOURCE ecp(id UINT32, x FLOAT64, y FLOAT64, theta FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR ecp TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|0.5|1609459200 +2|4.4000|50.7000|0.5|1609459200 + +CREATE SINK ecp_out(ecp.id UINT32, contains INT32) TYPE File; +SELECT id, TEMPORAL_ECONTAINS_TPOSE_GEOMETRY(x, y, theta, timestamp, 'POINT(4.3658 50.6456)') AS contains FROM ecp INTO ecp_out; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/edisjoint_tgeo_geo.test b/nes-systests/function/meos/edisjoint_tgeo_geo.test new file mode 100644 index 0000000000..76937a3623 --- /dev/null +++ b/nes-systests/function/meos/edisjoint_tgeo_geo.test @@ -0,0 +1,18 @@ +# name: function/spatiotemporal/MEOS_EDisjoint_Temporal_Geometry_Static_Geometry.test +# description: Per-event ever-disjoint between a single-instant tgeompoint built from event fields and a static geometry. Exercises the 4-arg one-temporal-point codegen shape (W1). +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, StaticGeometry, EDisjoint, Codegen] + +CREATE LOGICAL SOURCE edisjoint_tests(id UINT32, lon FLOAT64, lat FLOAT64, timestamp UINT64, geom_wkt VARSIZED); +CREATE PHYSICAL SOURCE FOR edisjoint_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200|'SRID=4326;POINT(4.3658 50.6456)' +2|4.1000|50.8000|1609459200|'SRID=4326;POINT(4.3658 50.6456)' + +CREATE SINK edisjoint_results(edisjoint_tests.id UINT32, disjoint INT32) TYPE File; +SELECT id, + TEMPORAL_EDISJOINT_GEOMETRY(lon, lat, timestamp, geom_wkt) AS disjoint +FROM edisjoint_tests +INTO edisjoint_results; +---- +1,0 +2,1 diff --git a/nes-systests/function/meos/edisjoint_tgeo_tgeo.test b/nes-systests/function/meos/edisjoint_tgeo_tgeo.test new file mode 100644 index 0000000000..980bd9ed9f --- /dev/null +++ b/nes-systests/function/meos/edisjoint_tgeo_tgeo.test @@ -0,0 +1,13 @@ +# name: MEOS_TemporalEDisjointTGeometry +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, EDisjoint] +CREATE LOGICAL SOURCE edt(id UINT32, lonA FLOAT64, latA FLOAT64, tsA UINT64, lonB FLOAT64, latB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR edt TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200|4.4000|50.7000|1609459200 +2|4.3658|50.6456|1609459200|4.3658|50.6456|1609459200 + +CREATE SINK edt_out(edt.id UINT32, disjoint INT32) TYPE File; +SELECT id, TEMPORAL_EDISJOINT_TGEOMETRY(lonA, latA, tsA, lonB, latB, tsB) AS disjoint FROM edt INTO edt_out; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/edwithin_tcbuffer_tcbuffer.test b/nes-systests/function/meos/edwithin_tcbuffer_tcbuffer.test new file mode 100644 index 0000000000..a9764c82cf --- /dev/null +++ b/nes-systests/function/meos/edwithin_tcbuffer_tcbuffer.test @@ -0,0 +1,18 @@ +# name: function/spatiotemporal/MEOS_TemporalEDWithinTCbufferTCbuffer.test +# description: Per-event ever-distance-within between two single-instant tcbuffers under a fixed threshold. Exercises the W13 codegen shape — new 9-arg lift template with two tcbuffer_in() per-event constructions plus a trailing double distance. +# groups: [Function, MEOS, SpatioTemporal, TCbuffer, EDWithin, Codegen] + +CREATE LOGICAL SOURCE tcbuf_dw_tests(id UINT32, lonA FLOAT64, latA FLOAT64, radiusA FLOAT64, tsA UINT64, lonB FLOAT64, latB FLOAT64, radiusB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR tcbuf_dw_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|0.0|0.0|1.0|1609459200|0.001|0.001|1.0|1609459200 +2|0.0|0.0|0.0001|1609459200|10.0|10.0|0.0001|1609459200 + +CREATE SINK tcbuf_dw_results(tcbuf_dw_tests.id UINT32, within INT32) TYPE File; +SELECT id, + TEMPORAL_EDWITHIN_TCBUFFER_TCBUFFER(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, FLOAT64(2.0)) AS within +FROM tcbuf_dw_tests +INTO tcbuf_dw_results; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/edwithin_tgeo_tgeo.test b/nes-systests/function/meos/edwithin_tgeo_tgeo.test new file mode 100644 index 0000000000..3abe936111 --- /dev/null +++ b/nes-systests/function/meos/edwithin_tgeo_tgeo.test @@ -0,0 +1,13 @@ +# name: MEOS_TemporalEDWithinTGeometry +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, EDWithin] +CREATE LOGICAL SOURCE ewt(id UINT32, lonA FLOAT64, latA FLOAT64, tsA UINT64, lonB FLOAT64, latB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR ewt TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200|4.3658|50.6456|1609459200 +2|4.3658|50.6456|1609459200|4.4000|50.7000|1609459200 + +CREATE SINK ewt_out(ewt.id UINT32, within INT32) TYPE File; +SELECT id, TEMPORAL_EDWITHIN_TGEOMETRY(lonA, latA, tsA, lonB, latB, tsB, FLOAT64(0.001)) AS within FROM ewt INTO ewt_out; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/edwithin_tpose_tpose.test b/nes-systests/function/meos/edwithin_tpose_tpose.test new file mode 100644 index 0000000000..0183e1fe6f --- /dev/null +++ b/nes-systests/function/meos/edwithin_tpose_tpose.test @@ -0,0 +1,18 @@ +# name: function/spatiotemporal/MEOS_TemporalEDWithinTPoseTPose.test +# description: Per-event ever-dwithin between two single-instant tgeompoints, each resolved from a tpose (x,y,theta,ts) via tpose_to_tpoint, then edwithin_tgeo_tgeo with a query-level distance constant (W20). Identical tposes are within any positive distance (expect 1); tposes ~0.07 deg apart are not within 0.001 (expect 0). +# groups: [Function, MEOS, SpatioTemporal, TPose, EDWithin, Composition, Codegen] + +CREATE LOGICAL SOURCE edw_tpose_tests(id UINT32, xA FLOAT64, yA FLOAT64, thetaA FLOAT64, tsA UINT64, xB FLOAT64, yB FLOAT64, thetaB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR edw_tpose_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|0.5|1609459200|4.3658|50.6456|0.5|1609459200 +2|4.3658|50.6456|0.5|1609459200|4.4000|50.7000|1.2|1609459200 + +CREATE SINK edw_tpose_results(edw_tpose_tests.id UINT32, within INT32) TYPE File; +SELECT id, + TEMPORAL_EDWITHIN_TPOSE_TPOSE(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB, FLOAT64(0.001)) AS within +FROM edw_tpose_tests +INTO edw_tpose_results; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/eintersects_tcbuffer_tcbuffer.test b/nes-systests/function/meos/eintersects_tcbuffer_tcbuffer.test new file mode 100644 index 0000000000..017cdae637 --- /dev/null +++ b/nes-systests/function/meos/eintersects_tcbuffer_tcbuffer.test @@ -0,0 +1,18 @@ +# name: function/spatiotemporal/MEOS_TemporalEIntersectsTCbufferTCbuffer.test +# description: Per-event ever-intersects between two single-instant tcbuffers (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB). Exercises the W12 codegen shape — new 8-arg lift template with two tcbuffer_in() per-event constructions. +# groups: [Function, MEOS, SpatioTemporal, TCbuffer, EIntersects, Codegen] + +CREATE LOGICAL SOURCE tcbuf_tcbuf_tests(id UINT32, lonA FLOAT64, latA FLOAT64, radiusA FLOAT64, tsA UINT64, lonB FLOAT64, latB FLOAT64, radiusB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR tcbuf_tcbuf_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|10.0|1609459200|4.3658|50.6456|5.0|1609459200 +2|4.3658|50.6456|0.0001|1609459200|4.5000|50.8000|0.0001|1609459200 + +CREATE SINK tcbuf_tcbuf_results(tcbuf_tcbuf_tests.id UINT32, intersects INT32) TYPE File; +SELECT id, + TEMPORAL_EINTERSECTS_TCBUFFER_TCBUFFER(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB) AS intersects +FROM tcbuf_tcbuf_tests +INTO tcbuf_tcbuf_results; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/eintersects_tnpoint_tnpoint.test b/nes-systests/function/meos/eintersects_tnpoint_tnpoint.test new file mode 100644 index 0000000000..f0d8d0454d --- /dev/null +++ b/nes-systests/function/meos/eintersects_tnpoint_tnpoint.test @@ -0,0 +1,18 @@ +# name: function/spatiotemporal/MEOS_TemporalEIntersectsTNpointTNpoint.test +# description: Per-event ever-intersects between two single-instant tgeompoints, each resolved from a temporal network point (rid, fraction, ts) via tnpoint_to_tgeompoint at runtime. Exercises the W18 two-tnpoint composition codegen shape — two tnpoint_in -> two tnpoint_to_tgeompoint -> existing eintersects_tgeo_tgeo (shipped in W3). Both operands land in the network SRID, so no mixed-SRID concern. NOTE: running this test requires the MEOS ways network present at /usr/local/share/ways1000.csv (see meos/examples/data/ways1000.csv in MobilityDB); without it MEOS errors "Cannot open the ways CSV file". Two npoints on the same route at the same fraction and instant resolve to the same point (expect 1); on different routes they resolve to different points (expect 0). +# groups: [Function, MEOS, SpatioTemporal, TNpoint, EIntersects, Composition, Codegen, Network] + +CREATE LOGICAL SOURCE tnpoint_eintersects_tests(id UINT32, ridA UINT64, fractionA FLOAT64, tsA UINT64, ridB UINT64, fractionB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR tnpoint_eintersects_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|55|0.5|1609459200|55|0.5|1609459200 +2|55|0.5|1609459200|99|0.5|1609459200 + +CREATE SINK tnpoint_eintersects_results(tnpoint_eintersects_tests.id UINT32, intersects INT32) TYPE File; +SELECT id, + TEMPORAL_EINTERSECTS_TNPOINT_TNPOINT(ridA, fractionA, tsA, ridB, fractionB, tsB) AS intersects +FROM tnpoint_eintersects_tests +INTO tnpoint_eintersects_results; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/eintersects_tpose_tpose.test b/nes-systests/function/meos/eintersects_tpose_tpose.test new file mode 100644 index 0000000000..41e03bb6e5 --- /dev/null +++ b/nes-systests/function/meos/eintersects_tpose_tpose.test @@ -0,0 +1,18 @@ +# name: function/spatiotemporal/MEOS_TemporalEIntersectsTPoseTPose.test +# description: Per-event ever-intersects between two single-instant tgeompoints, each lifted from a tpose (x, y, theta, ts) via tpose_to_tpoint at runtime. Exercises the W15 two-tpose composition codegen shape — two tpose_in -> two tpose_to_tpoint -> existing eintersects_tgeo_tgeo (shipped in W3). No new MEOS symbols are needed for tpose; mirrors MobilityDB PR #987's SQL-level composition recipe at the binding layer. +# groups: [Function, MEOS, SpatioTemporal, TPose, EIntersects, Composition, Codegen] + +CREATE LOGICAL SOURCE tpose_eintersects_tests(id UINT32, xA FLOAT64, yA FLOAT64, thetaA FLOAT64, tsA UINT64, xB FLOAT64, yB FLOAT64, thetaB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR tpose_eintersects_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|0.5|1609459200|4.3658|50.6456|1.2|1609459200 +2|4.3658|50.6456|0.5|1609459200|4.4000|50.7000|1.2|1609459200 + +CREATE SINK tpose_eintersects_results(tpose_eintersects_tests.id UINT32, intersects INT32) TYPE File; +SELECT id, + TEMPORAL_EINTERSECTS_TPOSE_TPOSE(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB) AS intersects +FROM tpose_eintersects_tests +INTO tpose_eintersects_results; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/float_extent.test b/nes-systests/function/meos/float_extent.test new file mode 100644 index 0000000000..e2901090c6 --- /dev/null +++ b/nes-systests/function/meos/float_extent.test @@ -0,0 +1,14 @@ +# name: MEOS_FloatExtent_Aggregation +# description: Windowed FLOAT_EXTENT — value extent (FLOATSPAN) over a tfloat stream via float_extent_transfn (W28 scalar-fold box-output aggregation). +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE fe(vehicle_id UINT64, value FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR fe TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|12.5|1609459200 +1|18.0|1609459201 +1|9.25|1609459202 + +CREATE SINK fe_out(fe.vehicle_id UINT64, fe.extent VARSIZED) TYPE File; +SELECT vehicle_id, FLOAT_EXTENT(value, timestamp) AS extent FROM fe GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO fe_out; +---- +1,[9.25, 18] diff --git a/nes-systests/function/meos/float_union.test b/nes-systests/function/meos/float_union.test new file mode 100644 index 0000000000..95f9393eec --- /dev/null +++ b/nes-systests/function/meos/float_union.test @@ -0,0 +1,15 @@ +# name: MEOS_FloatUnion_Aggregation +# description: Windowed FLOAT_UNION — value union (FLOATSET, deduped+sorted) over a tfloat stream via float_union_transfn + set_union_finalfn (W30 set-collect aggregation). +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE fu(vehicle_id UINT64, value FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR fu TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|12.5|1609459200 +1|18.0|1609459201 +1|9.25|1609459202 +1|12.5|1609459203 + +CREATE SINK fu_out(fu.vehicle_id UINT64, fu.vals VARSIZED) TYPE File; +SELECT vehicle_id, FLOAT_UNION(value, timestamp) AS vals FROM fu GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO fu_out; +---- +1,{9.25, 12.5, 18} diff --git a/nes-systests/function/meos/int_extent.test b/nes-systests/function/meos/int_extent.test new file mode 100644 index 0000000000..c976dd99f0 --- /dev/null +++ b/nes-systests/function/meos/int_extent.test @@ -0,0 +1,14 @@ +# name: MEOS_IntExtent_Aggregation +# description: Windowed INT_EXTENT — value extent (INTSPAN) over a tint stream via int_extent_transfn (W28 scalar-fold box-output aggregation). +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE ie(vehicle_id UINT64, value INT32, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR ie TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|12|1609459200 +1|18|1609459201 +1|9|1609459202 + +CREATE SINK ie_out(ie.vehicle_id UINT64, ie.extent VARSIZED) TYPE File; +SELECT vehicle_id, INT_EXTENT(value, timestamp) AS extent FROM ie GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO ie_out; +---- +1,[9, 19) diff --git a/nes-systests/function/meos/int_union.test b/nes-systests/function/meos/int_union.test new file mode 100644 index 0000000000..6218eaac4f --- /dev/null +++ b/nes-systests/function/meos/int_union.test @@ -0,0 +1,15 @@ +# name: MEOS_IntUnion_Aggregation +# description: Windowed INT_UNION — value union (INTSET, deduped+sorted) over a tint stream via int_union_transfn + set_union_finalfn (W30 set-collect aggregation). +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE iu(vehicle_id UINT64, value INT32, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR iu TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|12|1609459200 +1|18|1609459201 +1|9|1609459202 +1|12|1609459203 + +CREATE SINK iu_out(iu.vehicle_id UINT64, iu.vals VARSIZED) TYPE File; +SELECT vehicle_id, INT_UNION(value, timestamp) AS vals FROM iu GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO iu_out; +---- +1,{9, 12, 18} diff --git a/nes-systests/function/meos/left_stbox_stbox.test b/nes-systests/function/meos/left_stbox_stbox.test new file mode 100644 index 0000000000..c40d334ac0 --- /dev/null +++ b/nes-systests/function/meos/left_stbox_stbox.test @@ -0,0 +1,14 @@ +# name: MEOS_LeftStboxStbox_CrossVehicle +# description: Cross-vehicle LEFT_STBOX_STBOX over two per-vehicle extent STBoxes (each a VARSIZED stbox text, e.g. two TSPATIAL_EXTENT outputs in a self-join). Box A=((1,1),(3,3)); B=((2,2),(4,4)) overlaps A; C=((10,10),(11,11)) is disjoint and to the right of A. +# groups: [Function, MEOS, SpatioTemporal, Box, CrossStream] +CREATE LOGICAL SOURCE lsb(id UINT64, boxa VARSIZED, boxb VARSIZED); +CREATE PHYSICAL SOURCE FOR lsb TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|STBOX X((1,1),(3,3))|STBOX X((2,2),(4,4)) +2|STBOX X((1,1),(3,3))|STBOX X((10,10),(11,11)) + +CREATE SINK lsb_out(lsb.id UINT64, r BOOLEAN) TYPE File; +SELECT id, LEFT_STBOX_STBOX(boxa, boxb) AS r FROM lsb INTO lsb_out; +---- +1,0 +2,1 diff --git a/nes-systests/function/meos/left_tnumber_tnumber.test b/nes-systests/function/meos/left_tnumber_tnumber.test new file mode 100644 index 0000000000..d2f78aa832 --- /dev/null +++ b/nes-systests/function/meos/left_tnumber_tnumber.test @@ -0,0 +1,14 @@ +# name: MEOS_LeftTnumberTnumber_CrossVehicle +# description: Cross-vehicle LEFT_TNUMBER_TNUMBER over two per-vehicle tnumber aggregate outputs (each a VARSIZED hex-WKB tfloat). A=value[1,3]×time[t0,t2]; B=value[2,4]×time[t1,t3] (overlaps A); C=value[10,11]×time[t5,t6] (disjoint, right/after of A). +# groups: [Function, MEOS, TemporalNumber, CrossStream] +CREATE LOGICAL SOURCE ltn(id UINT64, ta VARSIZED, tb VARSIZED); +CREATE PHYSICAL SOURCE FOR ltn TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|0121000E0200000003000000000000F03F00A0AD30CA5A020000000000000008408024CC30CA5A0200|0121000E0200000003000000000000004040E2BC30CA5A02000000000000001040C066DB30CA5A0200 +2|0121000E0200000003000000000000F03F00A0AD30CA5A020000000000000008408024CC30CA5A0200|0121000E0200000003000000000000244040EBF930CA5A02000000000000002640802D0931CA5A0200 + +CREATE SINK ltn_out(ltn.id UINT64, r BOOLEAN) TYPE File; +SELECT id, LEFT_TNUMBER_TNUMBER(ta, tb) AS r FROM ltn INTO ltn_out; +---- +1,0 +2,1 diff --git a/nes-systests/function/meos/nad_tcbuffer_tcbuffer.test b/nes-systests/function/meos/nad_tcbuffer_tcbuffer.test new file mode 100644 index 0000000000..85e6404124 --- /dev/null +++ b/nes-systests/function/meos/nad_tcbuffer_tcbuffer.test @@ -0,0 +1,16 @@ +# name: function/spatiotemporal/MEOS_TemporalNADTCbufferTCbuffer.test +# description: Per-event nearest-approach distance between two single-instant tcbuffers (lon,lat,radius,ts), via nad_tcbuffer_tcbuffer (W21, double return; reuses the W12 two-tcbuffer template). Two identical tcbuffers (same centre and radius) overlap, so their nearest-approach distance is 0. +# groups: [Function, MEOS, SpatioTemporal, TCbuffer, NAD, Codegen] + +CREATE LOGICAL SOURCE nad_tcb_tests(id UINT32, lonA FLOAT64, latA FLOAT64, radiusA FLOAT64, tsA UINT64, lonB FLOAT64, latB FLOAT64, radiusB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR nad_tcb_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1.0|1609459200|4.3658|50.6456|1.0|1609459200 + +CREATE SINK nad_tcb_results(nad_tcb_tests.id UINT32, distance FLOAT64) TYPE File; +SELECT id, + TEMPORAL_NAD_TCBUFFER_TCBUFFER(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB) AS distance +FROM nad_tcb_tests +INTO nad_tcb_results; +---- +1,0 diff --git a/nes-systests/function/meos/nad_tfloat_float.test b/nes-systests/function/meos/nad_tfloat_float.test new file mode 100644 index 0000000000..3ae2d9855e --- /dev/null +++ b/nes-systests/function/meos/nad_tfloat_float.test @@ -0,0 +1,20 @@ +# name: function/spatiotemporal/MEOS_NAD_TFloat_Float.test +# description: Per-event nearest-approach distance between a single-instant tfloat and a scalar double. Exercises the 3-arg one-tnumber-point-with-scalar codegen shape (W5a). +# groups: [Function, MEOS, TNumber, TFloat, NAD, Codegen] + +CREATE LOGICAL SOURCE nad_tfloat_tests(id UINT32, value FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR nad_tfloat_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|42.5|1609459200 +2|17.0|1609459260 +3|3.14|1609459320 + +CREATE SINK nad_tfloat_results(nad_tfloat_tests.id UINT32, distance FLOAT64) TYPE File; +SELECT id, + TEMPORAL_NAD_FLOAT_SCALAR(value, timestamp, FLOAT64(40.0)) AS distance +FROM nad_tfloat_tests +INTO nad_tfloat_results; +---- +1,2.5 +2,23.0 +3,36.86 diff --git a/nes-systests/function/meos/nad_tfloat_tfloat.test b/nes-systests/function/meos/nad_tfloat_tfloat.test new file mode 100644 index 0000000000..6b67ceb03c --- /dev/null +++ b/nes-systests/function/meos/nad_tfloat_tfloat.test @@ -0,0 +1,13 @@ +# name: MEOS_NAD_TFloat_TFloat +# groups: [Function, MEOS, TNumber, TFloat, NAD] +CREATE LOGICAL SOURCE ntf(id UINT32, vA FLOAT64, tsA UINT64, vB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR ntf TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|42.5|1609459200|40.0|1609459200 +2|10.0|1609459200|10.0|1609459200 + +CREATE SINK ntf_out(ntf.id UINT32, distance FLOAT64) TYPE File; +SELECT id, TEMPORAL_NAD_TFLOAT(vA, tsA, vB, tsB) AS distance FROM ntf INTO ntf_out; +---- +1,2.5 +2,0 diff --git a/nes-systests/function/meos/nad_tpose_tpose.test b/nes-systests/function/meos/nad_tpose_tpose.test new file mode 100644 index 0000000000..f9f3ac7ff6 --- /dev/null +++ b/nes-systests/function/meos/nad_tpose_tpose.test @@ -0,0 +1,16 @@ +# name: function/spatiotemporal/MEOS_TemporalNADTPoseTPose.test +# description: Per-event nearest-approach distance between two single-instant tgeompoints, each resolved from a tpose (x,y,theta,ts) via tpose_to_tpoint, then nad_tgeo_tgeo (W19, double return). Two identical tposes resolve to the same point, so their nearest-approach distance is 0. +# groups: [Function, MEOS, SpatioTemporal, TPose, NAD, Composition, Codegen] + +CREATE LOGICAL SOURCE nad_tpose_tests(id UINT32, xA FLOAT64, yA FLOAT64, thetaA FLOAT64, tsA UINT64, xB FLOAT64, yB FLOAT64, thetaB FLOAT64, tsB UINT64); +CREATE PHYSICAL SOURCE FOR nad_tpose_tests TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|0.5|1609459200|4.3658|50.6456|0.5|1609459200 + +CREATE SINK nad_tpose_results(nad_tpose_tests.id UINT32, distance FLOAT64) TYPE File; +SELECT id, + TEMPORAL_NAD_TPOSE_TPOSE(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB) AS distance +FROM nad_tpose_tests +INTO nad_tpose_results; +---- +1,0 diff --git a/nes-systests/function/meos/overlaps_stbox_stbox.test b/nes-systests/function/meos/overlaps_stbox_stbox.test new file mode 100644 index 0000000000..2e927dd3be --- /dev/null +++ b/nes-systests/function/meos/overlaps_stbox_stbox.test @@ -0,0 +1,14 @@ +# name: MEOS_OverlapsStboxStbox_CrossVehicle +# description: Cross-vehicle OVERLAPS_STBOX_STBOX over two per-vehicle extent STBoxes (each a VARSIZED stbox text, e.g. two TSPATIAL_EXTENT outputs in a self-join). Box A=((1,1),(3,3)); B=((2,2),(4,4)) overlaps A; C=((10,10),(11,11)) is disjoint and to the right of A. +# groups: [Function, MEOS, SpatioTemporal, Box, CrossStream] +CREATE LOGICAL SOURCE osb(id UINT64, boxa VARSIZED, boxb VARSIZED); +CREATE PHYSICAL SOURCE FOR osb TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|STBOX X((1,1),(3,3))|STBOX X((2,2),(4,4)) +2|STBOX X((1,1),(3,3))|STBOX X((10,10),(11,11)) + +CREATE SINK osb_out(osb.id UINT64, r BOOLEAN) TYPE File; +SELECT id, OVERLAPS_STBOX_STBOX(boxa, boxb) AS r FROM osb INTO osb_out; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/overlaps_tnumber_tnumber.test b/nes-systests/function/meos/overlaps_tnumber_tnumber.test new file mode 100644 index 0000000000..8874d9016d --- /dev/null +++ b/nes-systests/function/meos/overlaps_tnumber_tnumber.test @@ -0,0 +1,14 @@ +# name: MEOS_OverlapsTnumberTnumber_CrossVehicle +# description: Cross-vehicle OVERLAPS_TNUMBER_TNUMBER over two per-vehicle tnumber aggregate outputs (each a VARSIZED hex-WKB tfloat). A=value[1,3]×time[t0,t2]; B=value[2,4]×time[t1,t3] (overlaps A); C=value[10,11]×time[t5,t6] (disjoint, right/after of A). +# groups: [Function, MEOS, TemporalNumber, CrossStream] +CREATE LOGICAL SOURCE otn(id UINT64, ta VARSIZED, tb VARSIZED); +CREATE PHYSICAL SOURCE FOR otn TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|0121000E0200000003000000000000F03F00A0AD30CA5A020000000000000008408024CC30CA5A0200|0121000E0200000003000000000000004040E2BC30CA5A02000000000000001040C066DB30CA5A0200 +2|0121000E0200000003000000000000F03F00A0AD30CA5A020000000000000008408024CC30CA5A0200|0121000E0200000003000000000000244040EBF930CA5A02000000000000002640802D0931CA5A0200 + +CREATE SINK otn_out(otn.id UINT64, r BOOLEAN) TYPE File; +SELECT id, OVERLAPS_TNUMBER_TNUMBER(ta, tb) AS r FROM otn INTO otn_out; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/temporal_copy_exp.test b/nes-systests/function/meos/temporal_copy_exp.test new file mode 100644 index 0000000000..d6f2a692b0 --- /dev/null +++ b/nes-systests/function/meos/temporal_copy_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TemporalCopyExp_Aggregation +# description: Value-output windowed aggregate — temporal_copy over the expandable mini-trip, result emitted as hex-WKB (proves f(traj)->Temporal serialized via temporal_as_hexwkb; the materialized sequence equals the TRAJECTORY_WKB output). +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tce(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tce TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tce_out(tce.vehicle_id UINT64, tce.traj VARSIZED) TYPE File; +SELECT vehicle_id, TEMPORAL_COPY_EXP(lon, lat, timestamp) AS traj FROM tce GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tce_out; +---- +1,012E000E03000000030101000000D88173469476114018265305A352494000A0AD30CA5A020001010000007B14AE47E17A1140333333333353494040E2BC30CA5A020001010000000000000000801140A4703D0AD75349408024CC30CA5A0200 diff --git a/nes-systests/function/meos/temporal_num_instants.test b/nes-systests/function/meos/temporal_num_instants.test new file mode 100644 index 0000000000..250feb9ffb --- /dev/null +++ b/nes-systests/function/meos/temporal_num_instants.test @@ -0,0 +1,17 @@ +# name: MEOS_TemporalNumInstants_Aggregation +# description: Windowed TEMPORAL_NUM_INSTANTS over per-(window,group) tgeo trajectory (W7 aggregation). +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE nin(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR nin TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 +2|5.0000|51.0000|1609459200 +2|5.0100|51.0100|1609459201 + +CREATE SINK nin_out(nin.vehicle_id UINT64, nin.n_instants INT32) TYPE File; +SELECT vehicle_id, TEMPORAL_NUM_INSTANTS(lon, lat, timestamp) AS n_instants FROM nin GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO nin_out; +---- +1,3 +2,2 diff --git a/nes-systests/function/meos/temporal_tfloat_max_value.test b/nes-systests/function/meos/temporal_tfloat_max_value.test new file mode 100644 index 0000000000..761661ae0d --- /dev/null +++ b/nes-systests/function/meos/temporal_tfloat_max_value.test @@ -0,0 +1,17 @@ +# name: MEOS_TemporalTFloatMaxValue_Aggregation +# description: Windowed TEMPORAL_TFLOAT_MAX_VALUE over per-(window,group) tfloat (W7 aggregation). +# groups: [Function, MEOS, TNumber, TFloat, Aggregation] +CREATE LOGICAL SOURCE tfm(sensor_id UINT64, reading FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tfm TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|10.5|1609459200 +1|22.7|1609459201 +1|18.3|1609459202 +2|5.0|1609459200 +2|99.9|1609459201 + +CREATE SINK tfm_out(tfm.sensor_id UINT64, tfm.peak FLOAT64) TYPE File; +SELECT sensor_id, TEMPORAL_TFLOAT_MAX_VALUE(reading, timestamp) AS peak FROM tfm GROUP BY sensor_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tfm_out; +---- +1,22.7 +2,99.9 diff --git a/nes-systests/function/meos/temporal_tnumber_twavg.test b/nes-systests/function/meos/temporal_tnumber_twavg.test new file mode 100644 index 0000000000..a771d577a3 --- /dev/null +++ b/nes-systests/function/meos/temporal_tnumber_twavg.test @@ -0,0 +1,17 @@ +# name: MEOS_TemporalTNumberTwAvg_Aggregation +# description: Windowed TEMPORAL_TNUMBER_TWAVG (time-weighted average) over per-(window,group) tnumber (W8 aggregation). +# groups: [Function, MEOS, TNumber, Aggregation] +CREATE LOGICAL SOURCE twa(sensor_id UINT64, reading FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR twa TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|10.0|1609459200 +1|20.0|1609459210 +1|30.0|1609459220 +2|5.0|1609459200 +2|15.0|1609459220 + +CREATE SINK twa_out(twa.sensor_id UINT64, twa.tw_average FLOAT64) TYPE File; +SELECT sensor_id, TEMPORAL_TNUMBER_TWAVG(reading, timestamp) AS tw_average FROM twa GROUP BY sensor_id WINDOW TUMBLING(timestamp, size 1 hour) INTO twa_out; +---- +1,20.0 +2,10.0 diff --git a/nes-systests/function/meos/temporal_tpoint_is_simple.test b/nes-systests/function/meos/temporal_tpoint_is_simple.test new file mode 100644 index 0000000000..0c467e69c0 --- /dev/null +++ b/nes-systests/function/meos/temporal_tpoint_is_simple.test @@ -0,0 +1,18 @@ +# name: MEOS_TemporalTPointIsSimple_Aggregation +# description: Windowed TEMPORAL_TPOINT_IS_SIMPLE over per-(window,group) tgeo trajectory (W9 aggregation). +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tis(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tis TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|0.0|0.0|1609459200 +1|1.0|1.0|1609459210 +1|2.0|2.0|1609459220 +2|0.0|0.0|1609459200 +2|1.0|1.0|1609459210 +2|0.0|0.0|1609459220 + +CREATE SINK tis_out(tis.vehicle_id UINT64, tis.is_simple BOOLEAN) TYPE File; +SELECT vehicle_id, TEMPORAL_TPOINT_IS_SIMPLE(lon, lat, timestamp) AS is_simple FROM tis GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tis_out; +---- +1,1 +2,0 diff --git a/nes-systests/function/meos/tgeo_convex_hull_exp.test b/nes-systests/function/meos/tgeo_convex_hull_exp.test new file mode 100644 index 0000000000..a646470b1b --- /dev/null +++ b/nes-systests/function/meos/tgeo_convex_hull_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TgeoConvexHullExp_Aggregation +# description: Windowed tgeompoint mini-trip grown on the in-process expandable Temporal* (appendInstant); TGEO_CONVEX_HULL_EXP emits a geometry value as canonical hex-EWKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tgch(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tgch TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tgch_out(tgch.vehicle_id UINT64, tgch.hull VARSIZED) TYPE File; +SELECT vehicle_id, TGEO_CONVEX_HULL_EXP(lon, lat, timestamp) AS hull FROM tgch GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tgch_out; +---- +1,0103000020E61000000100000004000000D88173469476114018265305A35249407B14AE47E17A114033333333335349400000000000801140A4703D0AD7534940D88173469476114018265305A3524940 diff --git a/nes-systests/function/meos/tgeo_end_value_exp.test b/nes-systests/function/meos/tgeo_end_value_exp.test new file mode 100644 index 0000000000..304ad472b3 --- /dev/null +++ b/nes-systests/function/meos/tgeo_end_value_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TgeoEndValueExp_Aggregation +# description: Windowed tgeompoint mini-trip grown on the in-process expandable Temporal* (appendInstant); TGEO_END_VALUE_EXP emits a geometry value as canonical hex-EWKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tgev(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tgev TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tgev_out(tgev.vehicle_id UINT64, tgev.endpt VARSIZED) TYPE File; +SELECT vehicle_id, TGEO_END_VALUE_EXP(lon, lat, timestamp) AS endpt FROM tgev GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tgev_out; +---- +1,0101000020E61000000000000000801140A4703D0AD7534940 diff --git a/nes-systests/function/meos/tgeo_start_value_exp.test b/nes-systests/function/meos/tgeo_start_value_exp.test new file mode 100644 index 0000000000..fe4b761b43 --- /dev/null +++ b/nes-systests/function/meos/tgeo_start_value_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TgeoStartValueExp_Aggregation +# description: Windowed tgeompoint mini-trip grown on the in-process expandable Temporal* (appendInstant); TGEO_START_VALUE_EXP emits a geometry value as canonical hex-EWKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tgsv(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tgsv TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tgsv_out(tgsv.vehicle_id UINT64, tgsv.startpt VARSIZED) TYPE File; +SELECT vehicle_id, TGEO_START_VALUE_EXP(lon, lat, timestamp) AS startpt FROM tgsv GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tgsv_out; +---- +1,0101000020E6100000D88173469476114018265305A3524940 diff --git a/nes-systests/function/meos/timestamptz_extent.test b/nes-systests/function/meos/timestamptz_extent.test new file mode 100644 index 0000000000..88cd9a580a --- /dev/null +++ b/nes-systests/function/meos/timestamptz_extent.test @@ -0,0 +1,14 @@ +# name: MEOS_TimestamptzExtent_Aggregation +# description: Windowed TIMESTAMPTZ_EXTENT — time extent (TSTZSPAN) over an event-time field via timestamptz_extent_transfn (W28 scalar-fold box-output aggregation). +# groups: [Function, MEOS, Time, Aggregation] +CREATE LOGICAL SOURCE te(vehicle_id UINT64, value UINT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR te TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|1609459200|1609459200 +1|1609459320|1609459320 +1|1609459260|1609459260 + +CREATE SINK te_out(te.vehicle_id UINT64, te.extent VARSIZED) TYPE File; +SELECT vehicle_id, TIMESTAMPTZ_EXTENT(value, timestamp) AS extent FROM te GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO te_out; +---- +1,[2021-01-01 00:00:00+00, 2021-01-01 00:02:00+00] diff --git a/nes-systests/function/meos/timestamptz_union.test b/nes-systests/function/meos/timestamptz_union.test new file mode 100644 index 0000000000..208bd1a235 --- /dev/null +++ b/nes-systests/function/meos/timestamptz_union.test @@ -0,0 +1,14 @@ +# name: MEOS_TimestamptzUnion_Aggregation +# description: Windowed TIMESTAMPTZ_UNION — time union (TSTZSET, deduped+sorted) over an event-time field via timestamptz_union_transfn + set_union_finalfn (W30 set-collect aggregation). +# groups: [Function, MEOS, Time, Aggregation] +CREATE LOGICAL SOURCE tu(vehicle_id UINT64, value UINT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tu TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|1609459200|1609459200 +1|1609459320|1609459320 +1|1609459260|1609459260 + +CREATE SINK tu_out(tu.vehicle_id UINT64, tu.vals VARSIZED) TYPE File; +SELECT vehicle_id, TIMESTAMPTZ_UNION(value, timestamp) AS vals FROM tu GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tu_out; +---- +1,{"2021-01-01 00:00:00+00", "2021-01-01 00:01:00+00", "2021-01-01 00:02:00+00"} diff --git a/nes-systests/function/meos/tlength_exp.test b/nes-systests/function/meos/tlength_exp.test new file mode 100644 index 0000000000..5c8c4434e7 --- /dev/null +++ b/nes-systests/function/meos/tlength_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TLengthExp_Aggregation +# description: Windowed trajectory length over an expandable Temporal* grown by appendInstant (no string-build, no WKB) — the MEOS-native streaming aggregation. tpoint_length applied directly to the live mini-trip sequence. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tle(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tle TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tle_out(tle.vehicle_id UINT64, tle.len FLOAT64) TYPE File; +SELECT vehicle_id, TLENGTH_EXP(lon, lat, timestamp) AS len FROM tle GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tle_out; +---- +1,0.0131538303422 diff --git a/nes-systests/function/meos/tnpoint_cumulative_length_exp.test b/nes-systests/function/meos/tnpoint_cumulative_length_exp.test new file mode 100644 index 0000000000..c048a273a3 --- /dev/null +++ b/nes-systests/function/meos/tnpoint_cumulative_length_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TnpointCumulativeLengthExp_Aggregation +# description: Windowed network-constrained trajectory grown by appendInstant over an expandable Temporal* (no string-build, no WKB) — tnpoint_cumulative_length applied to the live mini-trip sequence, resolving npoint routes against the loaded ways network. Output is the cumulative-length tfloat as hex-WKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalNetworkPoint, Aggregation] +CREATE LOGICAL SOURCE tncl(vehicle_id UINT64, rid INT64, frac FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tncl TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|1|0.1|1609459200 +1|1|0.5|1609459210 +1|1|0.9|1609459220 + +CREATE SINK tncl_out(tncl.vehicle_id UINT64, tncl.cumlen VARSIZED) TYPE File; +SELECT vehicle_id, TNPOINT_CUMULATIVE_LENGTH_EXP(rid, frac, timestamp) AS cumlen FROM tncl GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tncl_out; +---- +1,0121000E0200000003000000000000000000A0AD30CA5A02009A151B561B894C4000CDDE31CA5A0200 diff --git a/nes-systests/function/meos/tnpoint_speed_exp.test b/nes-systests/function/meos/tnpoint_speed_exp.test new file mode 100644 index 0000000000..1b0d6128df --- /dev/null +++ b/nes-systests/function/meos/tnpoint_speed_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TnpointSpeedExp_Aggregation +# description: Windowed network-constrained trajectory grown by appendInstant over an expandable Temporal* — tnpoint_speed differentiates the route-fraction motion against the loaded ways network, yielding the speed tfloat as hex-WKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalNetworkPoint, Aggregation] +CREATE LOGICAL SOURCE tnsp(vehicle_id UINT64, rid INT64, frac FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tnsp TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|1|0.1|1609459200 +1|1|0.5|1609459210 +1|1|0.9|1609459220 + +CREATE SINK tnsp_out(tnsp.vehicle_id UINT64, tnsp.speed VARSIZED) TYPE File; +SELECT vehicle_id, TNPOINT_SPEED_EXP(rid, frac, timestamp) AS speed FROM tnsp GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tnsp_out; +---- +1,0121000A020000000348117CDE15D4064000A0AD30CA5A020048117CDE15D4064000CDDE31CA5A0200 diff --git a/nes-systests/function/meos/tnpoint_to_tgeompoint_exp.test b/nes-systests/function/meos/tnpoint_to_tgeompoint_exp.test new file mode 100644 index 0000000000..8cdd577a6c --- /dev/null +++ b/nes-systests/function/meos/tnpoint_to_tgeompoint_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TnpointToTgeompointExp_Aggregation +# description: Windowed network-constrained trajectory grown by appendInstant over an expandable Temporal* — tnpoint_to_tgeompoint resolves each npoint route+fraction against the loaded ways network into spatial coordinates, yielding the tgeompoint trajectory as hex-WKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalNetworkPoint, Aggregation] +CREATE LOGICAL SOURCE tntg(vehicle_id UINT64, rid INT64, frac FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tntg TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|1|0.1|1609459200 +1|1|0.5|1609459210 +1|1|0.9|1609459220 + +CREATE SINK tntg_out(tntg.vehicle_id UINT64, tntg.geom VARSIZED) TYPE File; +SELECT vehicle_id, TNPOINT_TO_TGEOMPOINT_EXP(rid, frac, timestamp) AS geom FROM tntg GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tntg_out; +---- +1,012E000E0200000003010100000056DF00AF5A225340A8C3C4955BF1544000A0AD30CA5A02000101000000B0166F4E2D9534402E3F4E8B5340524000CDDE31CA5A0200 diff --git a/nes-systests/function/meos/tnumber_abs_exp.test b/nes-systests/function/meos/tnumber_abs_exp.test new file mode 100644 index 0000000000..37c94a0f56 --- /dev/null +++ b/nes-systests/function/meos/tnumber_abs_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TnumberAbsExp_Aggregation +# description: Value-output windowed aggregate — tnumber_abs over the expandable tfloat mini-series, result emitted as hex-WKB. All-positive input so abs is identity (the materialized tfloat sequence). +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE tae(vehicle_id UINT64, value FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tae TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|5.0|1609459200 +1|10.0|1609459201 +1|3.0|1609459202 + +CREATE SINK tae_out(tae.vehicle_id UINT64, tae.r VARSIZED) TYPE File; +SELECT vehicle_id, TNUMBER_ABS_EXP(value, timestamp) AS r FROM tae GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tae_out; +---- +1,0121000E0300000003000000000000144000A0AD30CA5A0200000000000000244040E2BC30CA5A020000000000000008408024CC30CA5A0200 diff --git a/nes-systests/function/meos/tnumber_extent.test b/nes-systests/function/meos/tnumber_extent.test new file mode 100644 index 0000000000..1a84efe0ff --- /dev/null +++ b/nes-systests/function/meos/tnumber_extent.test @@ -0,0 +1,14 @@ +# name: MEOS_TnumberExtent_Aggregation +# description: Windowed TNUMBER_EXTENT — numeric-temporal bounding box (TBox) over a per-(window,group) tfloat sequence via tnumber_extent_transfn (W27 box-output aggregation). +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE tne(vehicle_id UINT64, value FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tne TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|12.5|1609459200 +1|18.0|1609459201 +1|9.25|1609459202 + +CREATE SINK tne_out(tne.vehicle_id UINT64, tne.extent VARSIZED) TYPE File; +SELECT vehicle_id, TNUMBER_EXTENT(value, timestamp) AS extent FROM tne GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tne_out; +---- +1,TBOXFLOAT XT([9.25, 18],[2021-01-01 00:00:00+00, 2021-01-01 00:00:02+00]) diff --git a/nes-systests/function/meos/tnumber_trend_exp.test b/nes-systests/function/meos/tnumber_trend_exp.test new file mode 100644 index 0000000000..dcc9d23d1a --- /dev/null +++ b/nes-systests/function/meos/tnumber_trend_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TnumberTrendExp_Aggregation +# description: Windowed tnumber mini-series grown on the expandable Temporal*; tnumber_trend emits the rising/falling trend as a tint, hex-WKB. +# groups: [Function, MEOS, TemporalNumber, Aggregation] +CREATE LOGICAL SOURCE tte(vehicle_id UINT64, value FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tte TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|5.0|1609459200 +1|10.0|1609459201 +1|3.0|1609459202 + +CREATE SINK tte_out(tte.vehicle_id UINT64, tte.trend VARSIZED) TYPE File; +SELECT vehicle_id, TNUMBER_TREND_EXP(value, timestamp) AS trend FROM tte GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tte_out; +---- +1,0123000A03000000030100000000A0AD30CA5A0200FFFFFFFF40E2BC30CA5A0200FFFFFFFF8024CC30CA5A0200 diff --git a/nes-systests/function/meos/tpoint_cumulative_length_exp.test b/nes-systests/function/meos/tpoint_cumulative_length_exp.test new file mode 100644 index 0000000000..63ad99536e --- /dev/null +++ b/nes-systests/function/meos/tpoint_cumulative_length_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TpointCumulativeLengthExp_Aggregation +# description: Windowed tgeompoint mini-trip grown on the in-process expandable Temporal* (appendInstant); TPOINT_CUMULATIVE_LENGTH_EXP applied to the live sequence, emitted as hex-WKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tpcl(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tpcl TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tpcl_out(tpcl.vehicle_id UINT64, tpcl.cumlen VARSIZED) TYPE File; +SELECT vehicle_id, TPOINT_CUMULATIVE_LENGTH_EXP(lon, lat, timestamp) AS cumlen FROM tpcl GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tpcl_out; +---- +1,0121000E0300000003000000000000000000A0AD30CA5A0200F6F730223DEA783F40E2BC30CA5A02005002183965F08A3F8024CC30CA5A0200 diff --git a/nes-systests/function/meos/tpoint_get_x_exp.test b/nes-systests/function/meos/tpoint_get_x_exp.test new file mode 100644 index 0000000000..d7ec703fe2 --- /dev/null +++ b/nes-systests/function/meos/tpoint_get_x_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TpointGetXExp_Aggregation +# description: Windowed tgeompoint mini-trip grown on the in-process expandable Temporal* (appendInstant); TPOINT_GET_X_EXP applied to the live sequence, emitted as hex-WKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tpgx(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tpgx TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tpgx_out(tpgx.vehicle_id UINT64, tpgx.getx VARSIZED) TYPE File; +SELECT vehicle_id, TPOINT_GET_X_EXP(lon, lat, timestamp) AS getx FROM tpgx GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tpgx_out; +---- +1,0121000E0300000003D88173469476114000A0AD30CA5A02007B14AE47E17A114040E2BC30CA5A020000000000008011408024CC30CA5A0200 diff --git a/nes-systests/function/meos/tpoint_get_y_exp.test b/nes-systests/function/meos/tpoint_get_y_exp.test new file mode 100644 index 0000000000..4726b382ad --- /dev/null +++ b/nes-systests/function/meos/tpoint_get_y_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TpointGetYExp_Aggregation +# description: Windowed tgeompoint mini-trip grown on the in-process expandable Temporal* (appendInstant); TPOINT_GET_Y_EXP applied to the live sequence, emitted as hex-WKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tpgy(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tpgy TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tpgy_out(tpgy.vehicle_id UINT64, tpgy.gety VARSIZED) TYPE File; +SELECT vehicle_id, TPOINT_GET_Y_EXP(lon, lat, timestamp) AS gety FROM tpgy GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tpgy_out; +---- +1,0121000E030000000318265305A352494000A0AD30CA5A0200333333333353494040E2BC30CA5A0200A4703D0AD75349408024CC30CA5A0200 diff --git a/nes-systests/function/meos/tpoint_length_wkb.test b/nes-systests/function/meos/tpoint_length_wkb.test new file mode 100644 index 0000000000..24173006b7 --- /dev/null +++ b/nes-systests/function/meos/tpoint_length_wkb.test @@ -0,0 +1,12 @@ +# name: MEOS_TpointLengthWkb_FunctionOverValue +# description: The MEOS function library composing over a VARSIZED hex-WKB MEOS value — tpoint_length applied per record to an upstream trajectory value (temporal_from_hexwkb), the efficient compose-on-materialized-trajectory mechanism. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry] +CREATE LOGICAL SOURCE tlw(id UINT64, traj VARSIZED); +CREATE PHYSICAL SOURCE FOR tlw TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|012E000E03000000030101000000D88173469476114018265305A352494000A0AD30CA5A020001010000007B14AE47E17A1140333333333353494040E2BC30CA5A020001010000000000000000801140A4703D0AD75349408024CC30CA5A0200 + +CREATE SINK tlw_out(tlw.id UINT64, len FLOAT64) TYPE File; +SELECT id, TPOINT_LENGTH_WKB(traj) AS len FROM tlw INTO tlw_out; +---- +1,0.0131538303422 diff --git a/nes-systests/function/meos/tpoint_speed_exp.test b/nes-systests/function/meos/tpoint_speed_exp.test new file mode 100644 index 0000000000..2d44782e0a --- /dev/null +++ b/nes-systests/function/meos/tpoint_speed_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TpointSpeedExp_Aggregation +# description: Windowed tgeompoint mini-trip grown on the in-process expandable Temporal* (appendInstant); TPOINT_SPEED_EXP applied to the live sequence, emitted as hex-WKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tpsp(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tpsp TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tpsp_out(tpsp.vehicle_id UINT64, tpsp.speed VARSIZED) TYPE File; +SELECT vehicle_id, TPOINT_SPEED_EXP(lon, lat, timestamp) AS speed FROM tpsp GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tpsp_out; +---- +1,0121000A0300000003F6F730223DEA783F00A0AD30CA5A0200AB0CFF4F8DF67C3F40E2BC30CA5A0200AB0CFF4F8DF67C3F8024CC30CA5A0200 diff --git a/nes-systests/function/meos/tpoint_twcentroid_exp.test b/nes-systests/function/meos/tpoint_twcentroid_exp.test new file mode 100644 index 0000000000..84b2f28803 --- /dev/null +++ b/nes-systests/function/meos/tpoint_twcentroid_exp.test @@ -0,0 +1,14 @@ +# name: MEOS_TpointTwcentroidExp_Aggregation +# description: Windowed tgeompoint mini-trip grown on the in-process expandable Temporal* (appendInstant); TPOINT_TWCENTROID_EXP emits a geometry value as canonical hex-EWKB. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tptw(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tptw TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tptw_out(tptw.vehicle_id UINT64, tptw.twc VARSIZED) TYPE File; +SELECT vehicle_id, TPOINT_TWCENTROID_EXP(lon, lat, timestamp) AS twc FROM tptw GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tptw_out; +---- +1,0101000020E6100000B4EA73B5157B114048BF7D1D38534940 diff --git a/nes-systests/function/meos/trajectory_wkb.test b/nes-systests/function/meos/trajectory_wkb.test new file mode 100644 index 0000000000..e9523de9fd --- /dev/null +++ b/nes-systests/function/meos/trajectory_wkb.test @@ -0,0 +1,14 @@ +# name: MEOS_TrajectoryWkb_Aggregation +# description: Windowed mini-trip trajectory materialized as a hex-WKB sequence value — the value the MEOS function library composes over (the efficient materialize-once mechanism). Its output is exactly the input TPOINT_LENGTH_WKB consumes. +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE trw(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR trw TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK trw_out(trw.vehicle_id UINT64, trw.traj VARSIZED) TYPE File; +SELECT vehicle_id, TRAJECTORY_WKB(lon, lat, timestamp) AS traj FROM trw GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO trw_out; +---- +1,012E000E03000000030101000000D88173469476114018265305A352494000A0AD30CA5A020001010000007B14AE47E17A1140333333333353494040E2BC30CA5A020001010000000000000000801140A4703D0AD75349408024CC30CA5A0200 diff --git a/nes-systests/function/meos/tspatial_extent.test b/nes-systests/function/meos/tspatial_extent.test new file mode 100644 index 0000000000..75a5c1cb37 --- /dev/null +++ b/nes-systests/function/meos/tspatial_extent.test @@ -0,0 +1,14 @@ +# name: MEOS_TspatialExtent_Aggregation +# description: Windowed TSPATIAL_EXTENT — spatiotemporal bounding box (STBox) over a per-(window,group) tgeo trajectory via tspatial_extent_transfn (W27 box-output aggregation). +# groups: [Function, MEOS, SpatioTemporal, TemporalGeometry, Aggregation] +CREATE LOGICAL SOURCE tse(vehicle_id UINT64, lon FLOAT64, lat FLOAT64, timestamp UINT64); +CREATE PHYSICAL SOURCE FOR tse TYPE File SET('|' AS PARSER.FIELD_DELIMITER); +ATTACH INLINE +1|4.3658|50.6456|1609459200 +1|4.3700|50.6500|1609459201 +1|4.3750|50.6550|1609459202 + +CREATE SINK tse_out(tse.vehicle_id UINT64, tse.extent VARSIZED) TYPE File; +SELECT vehicle_id, TSPATIAL_EXTENT(lon, lat, timestamp) AS extent FROM tse GROUP BY vehicle_id WINDOW TUMBLING(timestamp, size 1 hour) INTO tse_out; +---- +1,STBOX XT(((4.3658,50.6456),(4.375,50.655)),[2021-01-01 00:00:00+00, 2021-01-01 00:00:02+00]) diff --git a/tools/codegen/.gitignore b/tools/codegen/.gitignore new file mode 100644 index 0000000000..7a60b85e14 --- /dev/null +++ b/tools/codegen/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +*.pyc diff --git a/tools/codegen/README.md b/tools/codegen/README.md new file mode 100644 index 0000000000..f203c8a380 --- /dev/null +++ b/tools/codegen/README.md @@ -0,0 +1,172 @@ +# MobilityNebula MEOS-operator codegen — design + generator + +This directory contains the design proposal and Python generator for +scaling MobilityNebula's MEOS-operator surface from the current +~17 hand-written operators (PRs #14, #15, #16, #17) to a larger +fraction of MEOS' ~1,949 streamable public functions, mirroring the +infrastructure parity that the Flink and Kafka platforms reached via +their codegen + wirings stacks. + +## Why codegen on Nebula + +The streaming-platform parity audit +([assessment](../../docs/berlinmod-streaming-forms.md)) shows: + +| Platform | Wirable MEOS surface | +|---|---:| +| Flink | 2,097 / 2,097 (100%) via codegen + 5 generic wiring classes | +| Kafka | 2,097 / 2,097 (100%) via codegen + 5 generic wiring classes | +| **Nebula** | **~17 / 2,097 (~1%)** via hand-written 4-layer pipeline per function | + +The Nebula gap is structural: each MEOS function on NebulaStream +requires a full **4-layer pipeline tuple** — logical class, physical +class, parser dispatch, lowering rule — totalling ~350–400 LOC of +mostly-mechanical boilerplate per function. Hand-writing all of MEOS' +streamable surface this way is multi-month engineering; codegen makes +it tractable. + +## What this codegen produces + +For each MEOS scalar function `f` in the input list, the generator +emits the four NebulaStream pipeline-layer files following the +established style of the existing hand-written operators +(`TemporalEDWithinGeometryLogicalFunction` etc.): + +``` +nes-logical-operators/include/Functions/Meos/LogicalFunction.hpp +nes-logical-operators/src/Functions/Meos/LogicalFunction.cpp +nes-physical-operators/include/Functions/Meos/PhysicalFunction.hpp +nes-physical-operators/src/Functions/Meos/PhysicalFunction.cpp +``` + +Plus updates to: +- `nes-logical-operators/src/Functions/Meos/CMakeLists.txt` +- `nes-physical-operators/src/Functions/Meos/CMakeLists.txt` +- Parser dispatch: a single block per generated function inserted into + `nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp` (manual edit + recommended; the generator emits the dispatch snippet for + copy-paste) +- Parser grammar: a single token per function added to + `nes-sql-parser/AntlrSQL.g4` (same) + +## Scope of this PR + +**Generator infrastructure only.** No generated C++ committed. Reasons: + +1. **Compile-environment constraint.** The generator's author cannot + build NebulaStream (full C++23 + vcpkg toolchain). Committing + unverified generated code would ship potentially broken operators. +2. **Per-function review value.** Mariana (maintainer) can run the + generator against a small input list (e.g. one MEOS family at a + time), review the output, iterate on the templates if needed, and + ship operators in follow-up PRs at a controlled pace. +3. **Template iteration cost.** First-pass templates may need + adjustment after the first build — better to land the generator + and iterate on templates than to ship a large batch of generated + operators that all have the same wrong shape. + +## How to use the generator + +```bash +# Edit the input list to choose which MEOS functions to generate +$EDITOR tools/codegen/codegen_input.example.json + +# Run the generator +python3 tools/codegen/codegen_nebula.py \ + --input tools/codegen/codegen_input.example.json \ + --output-root . + +# Output: +# nes-logical-operators/include/Functions/Meos/LogicalFunction.hpp +# nes-logical-operators/src/Functions/Meos/LogicalFunction.cpp +# nes-physical-operators/include/Functions/Meos/PhysicalFunction.hpp +# nes-physical-operators/src/Functions/Meos/PhysicalFunction.cpp +# +# Plus a stderr-printed "parser snippet" per function that you paste into +# nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp (the parser dispatch), +# and a "grammar snippet" that you paste into AntlrSQL.g4 +``` + +## Input format + +`codegen_input.example.json` is a list of MEOS-function descriptors. +One descriptor per output operator: + +```json +{ + "operators": [ + { + "nebula_name": "TemporalEDisjointGeometry", + "sql_token": "TEMPORAL_EDISJOINT_GEOMETRY", + "meos_call": "edisjoint_tgeo_geo", + "args": [ + {"name": "lon", "nautilus_type": "double", "cpp_type": "double"}, + {"name": "lat", "nautilus_type": "double", "cpp_type": "double"}, + {"name": "timestamp","nautilus_type": "uint64_t", "cpp_type": "uint64_t"}, + {"name": "geometry", "nautilus_type": "VariableSizedData", "cpp_type": "const char*"} + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_temporal_point": true, + "comment_one_liner": "Per-event ever-disjoint between a tgeompoint built from event fields and a static geometry." + } + ] +} +``` + +Field meanings: +- `nebula_name`: PascalCase NebulaStream class name (without `LogicalFunction` / `PhysicalFunction` suffix; the generator adds those) +- `sql_token`: the uppercase SQL function name (Antlr lexer token) +- `meos_call`: the underlying MEOS C function symbol the physical operator wraps +- `args`: ordered list of per-record argument fields; the generator builds the constructor + `parameters` vector from these +- `return_type` / `nautilus_return`: the MEOS function's C return type and the NebulaStream `DataType::Type` enum value +- `build_temporal_point`: if true, the physical operator builds a single-instant tgeompoint from `(lon, lat, timestamp)` before calling MEOS (the common pattern for spatial predicates); if false, the operator passes args directly to MEOS +- `comment_one_liner`: drops into the Javadoc-equivalent C++ doc comment + +## Templates + +The generator's templates are embedded in the Python source as +multi-line f-strings. They mirror the exact layout of the existing +hand-written operators (`TemporalEDWithinGeometryLogicalFunction` and +its physical sibling are the reference; the templates were derived by +1:1 inspection of those files). + +To adjust a template (e.g. when NebulaStream's `LogicalFunctionConcept` +adds a new override), edit the corresponding string in +`codegen_nebula.py`; the change applies to all subsequent +regenerations. + +## Scaling path (recommended sequence) + +| Wave | Scope | Expected output | Effort estimate | +|---|---|---|---| +| W1 | First batch: 5 MEOS spatial-relation E/A predicates (e.g. `TemporalEDisjoint`, `TemporalATouches`, `TemporalECovers`, `TemporalACrosses`, `TemporalAOverlaps`) | 20 generated files + 5 parser entries | Single follow-up PR after this generator lands | +| W2 | All ever / always spatial-relation predicates over `tgeo_geo` (~18 functions) | 72 generated files | ~1 follow-up PR | +| W3 | Distance functions over `tgeo_geo` and `tgeo_tgeo` (NAD, NAI, distance, etc.) | ~30 generated files | ~1 follow-up PR | +| W4 | Scalar accessors that decompose to per-event reads | template extension required (read MEOS handle) | design decision point | +| W5 | Aggregations (windowed / cross-stream) | separate generator (aggregation 4-layer pattern is different from scalar 4-layer pattern; the existing TEMPORAL_LENGTH / PAIR_MEETING / CROSS_DISTANCE shape) | full aggregation-codegen design | + +Per-PR scope keeps the review surface small and lets each batch land +with its own build verification. + +## What the generator does NOT do (deliberately) + +- **No build-system integration.** The CMakeLists updates are emitted + as text snippets for the maintainer to apply manually. This avoids + the generator silently corrupting CMakeLists on regeneration. +- **No parser/grammar integration.** Same reason — the dispatch and + grammar snippets are emitted to stderr for manual paste. +- **No aggregation-pattern support yet.** Aggregations require a + different 4-layer shape (lift/combine/lower/cleanup) that depends + on per-aggregation state design. A separate generator with the + aggregation-specific template is W5 in the table above. + +## Compile-verification note + +The generator's first output should be reviewed against an existing +hand-written operator for shape parity, then `mvn compile` (or the +NebulaStream `cmake --build` equivalent) should be run against a +single small batch (1–2 generated functions) before scaling up. The +generator's templates are derived 1:1 from the existing operator +shape but have not been compile-tested in this PR (out of the +generator author's environment). diff --git a/tools/codegen/build_descriptor.py b/tools/codegen/build_descriptor.py new file mode 100644 index 0000000000..7d1374dc5f --- /dev/null +++ b/tools/codegen/build_descriptor.py @@ -0,0 +1,451 @@ +#!/usr/bin/env python3 +"""Build a codegen_nebula.py descriptor from classified MEOS gap functions. + +Reads a header-signature dump (one `extern ();` per line, as +produced from the in-container /usr/local/include/meos*.h) plus a gap list +(streamable functions not yet wired by a Nebula operator), classifies each +function into a known operator SHAPE, and emits the JSON descriptor that +codegen_nebula.py consumes. + +A SHAPE knows: the per-event SQL arg list, the `build_*` flag selecting the +physical-cpp template, the MEOS return marshaling, and the per-base-type input +ctor (tfloat_in / tint_in / ...). Adding a family = adding a classifier here; +the C++ templates live in codegen_nebula.py. + +This keeps the bulk-emission measured-not-guessed: only functions whose exact +in-header signature matches a SHAPE are emitted, and only if they are in the +gap. Functions that don't match any SHAPE are reported, never silently dropped. + +Usage: + build_descriptor.py --sigs /tmp/cmp_sigs.txt --gap /tmp/nebula_gap.txt \\ + --shapes cmp_scalar_tempfirst --out wave22.json +""" +import argparse +import json +import re +import sys + +# --- per-base-type input construction ------------------------------------- +# token in the meos-call name -> (tnumber_in_fn, cpp value type, wkt format) +BASE = { + "tfloat": ("tfloat_in", "double", "{}@{}"), + "tint": ("tint_in", "int", "{}@{}"), +} +SCALAR_CPP = {"double": "double", "int": "int"} + + +def pascal(meos_call): + return "".join(p.capitalize() for p in meos_call.split("_")) + + +def parse_sigs(path): + """name -> (ret, [normalized-arg-type, ...]).""" + out = {} + for ln in open(path): + m = re.match(r"extern\s+([\w ]+?)\s*(\*?)\s*(\w+)\(([^)]*)\);", ln.strip()) + if not m: + continue + ret = (m.group(1) + m.group(2)).strip() + name = m.group(3) + args = [] + for a in m.group(4).split(","): + a = a.strip() + if not a or a == "void": + continue + base = re.sub(r"^const\s+", "", a) + ty = base.split()[0] + ("*" if "*" in a else "") + args.append(ty) + out[name] = (ret, tuple(args)) + return out + + +# --- SHAPE classifiers ------------------------------------------------------ +# Each returns a descriptor dict for `fn` if it matches, else None. + +def cmp_scalar_tempfirst(fn, ret, args): + """ever/always comparison: int fn(const Temporal*, double|int), temp first. + Reuses build_tnumber_point_with_scalar (already in codegen_nebula.py).""" + if ret != "int" or args not in (("Temporal*", "double"), ("Temporal*", "int")): + return None + base = "tfloat" if args[1] == "double" else "tint" + in_fn, vcpp, wkt = BASE[base] + return { + "nebula_name": pascal(fn), + "sql_token": fn.upper(), + "meos_call": fn, + "args": [ + {"name": "value", "nautilus_type": vcpp, "cpp_type": vcpp}, + {"name": "timestamp", "nautilus_type": "uint64_t", "cpp_type": "uint64_t"}, + {"name": "scalar", "nautilus_type": vcpp, "cpp_type": vcpp}, + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_tnumber_point_with_scalar": True, + "tnumber_value_cpp_type": vcpp, + "scalar_cpp_type": SCALAR_CPP[vcpp], + "tnumber_wkt_format": wkt, + "tnumber_in_fn": in_fn, + "comment_one_liner": ( + f"Per-event {fn.split('_')[0]} comparison of a single-instant {base} " + f"(built from value+timestamp) against a scalar constant."), + } + + +def cmp_scalar_scalarfirst(fn, ret, args): + """ever/always comparison: int fn(double|int, const Temporal*), scalar first. + Reuses build_tnumber_scalar_first (MEOS call passes scalar as 1st arg).""" + if ret != "int" or args not in (("double", "Temporal*"), ("int", "Temporal*")): + return None + base = "tfloat" if args[0] == "double" else "tint" + in_fn, vcpp, wkt = BASE[base] + return { + "nebula_name": pascal(fn), + "sql_token": fn.upper(), + "meos_call": fn, + "args": [ + {"name": "value", "nautilus_type": vcpp, "cpp_type": vcpp}, + {"name": "timestamp", "nautilus_type": "uint64_t", "cpp_type": "uint64_t"}, + {"name": "scalar", "nautilus_type": vcpp, "cpp_type": vcpp}, + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_tnumber_scalar_first": True, + "tnumber_value_cpp_type": vcpp, + "scalar_cpp_type": SCALAR_CPP[vcpp], + "tnumber_wkt_format": wkt, + "tnumber_in_fn": in_fn, + "comment_one_liner": ( + f"Per-event {fn.split('_')[0]} comparison of a scalar constant against a " + f"single-instant {base} (built from value+timestamp); scalar-first MEOS arg order."), + } + + +def cmp_two_temporal(fn, ret, args): + """Generic two-temporal comparison: int fn(const Temporal*, const Temporal*) + on the *_temporal_temporal functions. Builds two single-instant tfloats from + (valueA,tsA)/(valueB,tsB) and reuses build_two_tnumber_points.""" + if ret != "int" or args != ("Temporal*", "Temporal*") or not fn.endswith("_temporal_temporal"): + return None + in_fn, vcpp, wkt = BASE["tfloat"] + return { + "nebula_name": pascal(fn), + "sql_token": fn.upper(), + "meos_call": fn, + "args": [ + {"name": "valueA", "nautilus_type": vcpp, "cpp_type": vcpp}, + {"name": "tsA", "nautilus_type": "uint64_t", "cpp_type": "uint64_t"}, + {"name": "valueB", "nautilus_type": vcpp, "cpp_type": vcpp}, + {"name": "tsB", "nautilus_type": "uint64_t", "cpp_type": "uint64_t"}, + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_two_tnumber_points": True, + "tnumber_value_cpp_type": vcpp, + "tnumber_wkt_format": wkt, + "tnumber_in_fn": in_fn, + "comment_one_liner": ( + f"Per-event {fn.split('_')[0]} comparison between two single-instant " + f"temporals (built from valueA/tsA and valueB/tsB)."), + } + + +def _args(spec): + return [{"name": n, "nautilus_type": t, + "cpp_type": "const char*" if t == "VariableSizedData" else t} for n, t in spec] + + +# per-template SQL arg layouts (must match the physical-cpp template's parameterValues order) +_A_TGEO_GEO = [("lon", "double"), ("lat", "double"), ("timestamp", "uint64_t"), ("geometry", "VariableSizedData")] +_A_TWO_TGEO = [("lonA", "double"), ("latA", "double"), ("tsA", "uint64_t"), + ("lonB", "double"), ("latB", "double"), ("tsB", "uint64_t")] +_A_TCB_CB = [("lon", "double"), ("lat", "double"), ("radius", "double"), ("timestamp", "uint64_t"), ("cbuffer", "VariableSizedData")] +_A_TWO_TCB = [("lonA", "double"), ("latA", "double"), ("radiusA", "double"), ("tsA", "uint64_t"), + ("lonB", "double"), ("latB", "double"), ("radiusB", "double"), ("tsB", "uint64_t")] + + +_SCALAR_RET = {"int": ("int", "INT32"), "double": ("double", "FLOAT64"), "bool": ("bool", "BOOLEAN")} + + +def _mk_scalar(fn, flag, argspec, note, ret="int"): + rt, nr = _SCALAR_RET[ret] + return { + "nebula_name": pascal(fn), + "sql_token": fn.upper(), + "meos_call": fn, + "args": _args(argspec), + "return_type": rt, + "nautilus_return": nr, + flag: True, + "comment_one_liner": note, + } + + +def sprel_scalar_existing(fn, ret, args): + """Scalar-returning (int/double/bool) spatial-relation / comparison / topological / + distance whose per-event input build is already covered by an existing + physical-cpp template. Routes by arg-shape + type token; returns None for + shapes needing a new template (tnpoint/tpose native two-temporal, reversed-arg, + text/bool object args, non-scalar return).""" + if ret not in _SCALAR_RET: + return None + if args == ("Temporal*", "GSERIALIZED*") and ("_tgeo_" in fn or "_tpoint_" in fn or "_tspatial_" in fn): + return _mk_scalar(fn, "build_temporal_point", _A_TGEO_GEO, + f"Per-event {fn}: single-instant tgeompoint vs a static geometry -> {ret}.", ret) + if args == ("Temporal*", "Temporal*") and "tcbuffer" in fn: + return _mk_scalar(fn, "build_two_tcbuffer_points", _A_TWO_TCB, + f"Per-event {fn} between two single-instant tcbuffers -> {ret}.", ret) + if args == ("Temporal*", "Temporal*") and not ("tnpoint" in fn or "tpose" in fn or "tnumber" in fn): + return _mk_scalar(fn, "build_two_temporal_points", _A_TWO_TGEO, + f"Per-event {fn} between two single-instant tgeompoints -> {ret}.", ret) + if args == ("Temporal*", "Cbuffer*"): + return _mk_scalar(fn, "build_tcbuffer_point_cbuffer", _A_TCB_CB, + f"Per-event {fn}: single-instant tcbuffer vs a static cbuffer -> {ret}.", ret) + return None + + +# leading/embedded type token -> generic input-builder key (codegen_nebula GENERIC_INPUTS) +_GENERIC_INPUT_FOR = [ + ("tgeompoint", "tgeompoint"), ("tgeogpoint", "tgeompoint"), ("tgeometry", "tgeometry"), + ("tcbuffer", "tcbuffer"), ("tnpoint", "tnpoint"), ("tpose", "tpose"), + ("tfloat", "tfloat"), ("tint", "tint"), ("tbool", "tbool"), + ("tnumber", "tfloat"), ("tgeo", "tgeompoint"), ("tpoint", "tgeompoint"), + ("tspatial", "tgeompoint"), +] + + +def _infer_input(fn): + for tok, inp in _GENERIC_INPUT_FOR: + if fn.startswith(tok + "_") or ("_" + tok + "_") in fn or fn.endswith("_" + tok): + return inp + return None + + +def temporal_unary_scalar(fn, ret, args): + """Unary scalar accessor: int|double|bool fn(const Temporal*). Generic shape; + input type inferred from the name token.""" + if args != ("Temporal*",): + return None + rk = {"int": "int", "double": "double", "bool": "bool"}.get(ret) + if not rk: + return None + inp = _infer_input(fn) + if not inp: + return None + return { + "nebula_name": pascal(fn), "sql_token": fn.upper(), "meos_call": fn, + "build_generic": True, "input_type": inp, "extra_args": [], "return_kind": rk, + "comment_one_liner": f"Per-event {fn}: {rk} accessor over a single-instant {inp}.", + } + + +_SCALAR_CPP = {"double": "double", "int": "int32_t", "bool": "bool"} + + +def temporal_x_scalar(fn, ret, args): + """int|double|bool fn(const Temporal*, scalar). Generic shape, one scalar extra.""" + if len(args) != 2 or args[0] != "Temporal*" or args[1] not in _SCALAR_CPP: + return None + rk = {"int": "int", "double": "double", "bool": "bool"}.get(ret) + inp = _infer_input(fn) + if not rk or not inp: + return None + return { + "nebula_name": pascal(fn), "sql_token": fn.upper(), "meos_call": fn, + "build_generic": True, "input_type": inp, + "extra_args": [{"kind": "scalar", "cpp": _SCALAR_CPP[args[1]]}], "return_kind": rk, + "comment_one_liner": f"Per-event {fn}: single-instant {inp} against a scalar -> {rk}.", + } + + +def temporal_x_geom(fn, ret, args): + """int|double|bool fn(const Temporal*, const GSERIALIZED*). Generic shape, one geom extra.""" + if args != ("Temporal*", "GSERIALIZED*"): + return None + rk = {"int": "int", "double": "double", "bool": "bool"}.get(ret) + inp = _infer_input(fn) + if not rk or not inp: + return None + return { + "nebula_name": pascal(fn), "sql_token": fn.upper(), "meos_call": fn, + "build_generic": True, "input_type": inp, + "extra_args": [{"kind": "geom"}], "return_kind": rk, + "comment_one_liner": f"Per-event {fn}: single-instant {inp} against a static geometry -> {rk}.", + } + + +def _result_extract_kind(fn): + """Scalar return_kind for a Temporal*-returning transform whose single-instant + result carries a tint/tfloat/tbool value — inferred from the function name.""" + if "_to_tint" in fn: + return "extract_int" + if "_to_tfloat" in fn: + return "extract_double" + if "_to_tbool" in fn: + return "extract_bool" + if fn.startswith("tfloat_"): + return "extract_double" + if fn.startswith("tint_"): + return "extract_int" + if fn.startswith("tbool_"): + return "extract_bool" + return None + + +def temporal_extract_scalar(fn, ret, args): + """Unary Temporal->Temporal* transform whose single-instant result carries a + scalar value (tfloat_ceil, tbool_to_tint, ...). Generic shape with an extract + marshaler. Result/text/geo-returning transforms are deferred (varsize).""" + if ret != "Temporal*" or args != ("Temporal*",): + return None + inp = _infer_input(fn) + rk = _result_extract_kind(fn) + if not inp or not rk: + return None + return { + "nebula_name": pascal(fn), "sql_token": fn.upper(), "meos_call": fn, + "build_generic": True, "input_type": inp, "extra_args": [], "return_kind": rk, + "comment_one_liner": f"Per-event {fn}: single-instant {inp} transform, value extracted -> {rk[8:]}.", + } + + +_BOX_PARSER = { # name-suffix token -> (cpp box type, MEOS parser, header) + "stbox": ("STBox", "stbox_in", "meos_geo.h"), + "tbox": ("TBox", "tbox_in", "meos.h"), + "tstzspan": ("Span", "tstzspan_in", "meos.h"), +} + + +# C arg-type -> (cpp box type, MEOS parser, header). Used for the box-first form +# where the box token is not the function-name suffix. STBox/TBox only: a bare +# `Span*` is ambiguous (tstzspan vs floatspan/numspan) so the box-first path +# skips it — the temporal-first path keeps resolving Span via the name suffix. +_BOXTYPE_PARSER = { + "STBox*": ("STBox", "stbox_in", "meos_geo.h"), + "TBox*": ("TBox", "tbox_in", "meos.h"), +} + + +def temporal_x_box(fn, ret, args): + """int|double|bool fn over a Temporal and an STBox/TBox/Span query LITERAL, + in EITHER argument order (e.g. `left_tspatial_stbox(temp, box)` and + `above_stbox_tspatial(box, temp)`). The literal is parsed at runtime + (stbox_in/tbox_in/tstzspan_in). For the temporal-first form the box type is + the name suffix (distinguishing tstzspan from numspan); for the box-first + form it is the C arg type (STBox/TBox).""" + if len(args) != 2: + return None + rk = {"int": "int", "double": "double", "bool": "bool"}.get(ret) + inp = _infer_input(fn) + if not rk or not inp: + return None + box_first = False + if args[0] == "Temporal*" and args[1] in ("STBox*", "TBox*", "Span*"): + tok = next((t for t in _BOX_PARSER if fn.endswith("_" + t)), None) + if not tok: + return None + bt, parser, hdr = _BOX_PARSER[tok] + elif args[1] == "Temporal*" and args[0] in _BOXTYPE_PARSER: + bt, parser, hdr = _BOXTYPE_PARSER[args[0]] + box_first = True + else: + return None + d = { + "nebula_name": pascal(fn), "sql_token": fn.upper(), "meos_call": fn, + "build_generic": True, "input_type": inp, "return_kind": rk, + "extra_args": [{"kind": "box", "box_type": bt, "parser": parser, "header": hdr}], + "comment_one_liner": f"Per-event {fn}: single-instant {inp} against a {bt} literal -> {rk}.", + } + if box_first: + d["box_first"] = True + return d + + +def stbox_x_stbox(fn, ret, args): + """bool|double fn(const STBox*, const STBox*) — a cross-vehicle comparison over + two per-vehicle extent boxes (each carried as a VARSIZED stbox-text field, e.g. + two TSPATIAL_EXTENT outputs in a self-join). The first box is the primary + stbox_text input; the second is a `box` extra arg; both are stbox_in-parsed and + freed. This is the production-faithful cross-stream shape: per-vehicle + aggregates (GROUP BY vehicle_id) compared pairwise downstream.""" + if len(args) != 2 or args[0] != "STBox*" or args[1] != "STBox*": + return None + rk = {"bool": "bool", "double": "double", "int": "int"}.get(ret) + if not rk: + return None + return { + "nebula_name": pascal(fn), "sql_token": fn.upper(), "meos_call": fn, + "build_generic": True, "input_type": "stbox_text", "return_kind": rk, + "extra_args": [{"kind": "box", "box_type": "STBox", "parser": "stbox_in", "header": "meos_geo.h"}], + "comment_one_liner": f"Per-event {fn}: two per-vehicle extent STBoxes -> {rk}.", + } + + +def two_temporal_scalar(fn, ret, args): + """bool|int|double fn(const Temporal*, const Temporal*) over TWO temporal + operands carried as hex-WKB VARSIZED fields — the cross-vehicle f(trajA, trajB) + scalar shape (e.g. two per-vehicle aggregate outputs compared in a self-join). + The first temporal is the primary wkb_temporal input; the second is a + wkb_temporal extra arg; both temporal_from_hexwkb-parsed and freed.""" + if len(args) != 2 or args[0] != "Temporal*" or args[1] != "Temporal*": + return None + rk = {"bool": "bool", "int": "int", "double": "double"}.get(ret) + if not rk: + return None + return { + "nebula_name": pascal(fn), "sql_token": fn.upper(), "meos_call": fn, + "build_generic": True, "input_type": "wkb_temporal", "return_kind": rk, + "extra_args": [{"kind": "wkb_temporal"}], + "comment_one_liner": f"Per-event {fn}: two hex-WKB temporal operands -> {rk}.", + } + + +SHAPES = { + "cmp_scalar_tempfirst": cmp_scalar_tempfirst, + "cmp_scalar_scalarfirst": cmp_scalar_scalarfirst, + "cmp_two_temporal": cmp_two_temporal, + "two_temporal_scalar": two_temporal_scalar, + "sprel_scalar_existing": sprel_scalar_existing, + "temporal_unary_scalar": temporal_unary_scalar, + "temporal_x_scalar": temporal_x_scalar, + "temporal_x_geom": temporal_x_geom, + "temporal_extract_scalar": temporal_extract_scalar, + "temporal_x_box": temporal_x_box, + "stbox_x_stbox": stbox_x_stbox, +} + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--sigs", required=True, help="header signature dump") + ap.add_argument("--gap", required=True, help="streamable-not-wired function list") + ap.add_argument("--shapes", required=True, + help="comma-separated SHAPE names to apply (order = match priority)") + ap.add_argument("--out", required=True, help="descriptor JSON output path") + a = ap.parse_args() + + sigs = parse_sigs(a.sigs) + gap = {ln.strip() for ln in open(a.gap) if ln.strip()} + shapes = [SHAPES[s] for s in a.shapes.split(",")] + + ops, unmatched = [], [] + for fn in sorted(gap): + if fn not in sigs: + continue + ret, args = sigs[fn] + for cls in shapes: + d = cls(fn, ret, args) + if d: + ops.append(d) + break + else: + unmatched.append(fn) + + json.dump({"_comment": f"codegen descriptor; shapes={a.shapes}", "operators": ops}, + open(a.out, "w"), indent=2) + sys.stderr.write(f"emitted {len(ops)} operator descriptor(s) -> {a.out}\n") + sys.stderr.write(f"(gap functions present in sig-dump but unmatched by these shapes: " + f"{len([f for f in unmatched if f in sigs])})\n") + + +if __name__ == "__main__": + main() diff --git a/tools/codegen/build_local.sh b/tools/codegen/build_local.sh new file mode 100755 index 0000000000..a3d78c139a --- /dev/null +++ b/tools/codegen/build_local.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# Local compile-check of the generated MEOS operator + parser libraries in the +# NebulaStream dev image. +# +# The dev image ships without PahoMqttCpp (CI's image has it), so a configure +# that activates the optional MQTT Source/Sink plugins fails. Those plugins are +# irrelevant to the MEOS operator libraries, so this wrapper disables them for +# the local configure and ALWAYS restores nes-plugins/CMakeLists.txt afterwards +# (trap on EXIT) — no manual sed, and the working tree is never left modified +# even if the build fails or is interrupted. +# +# Usage: +# tools/codegen/build_local.sh [target ...] # default: the 3 op/parser libs +# NES_DEV_IMAGE=... BUILD_DIR=... tools/codegen/build_local.sh +# +set -euo pipefail +ROOT="$(git rev-parse --show-toplevel)" +PLUGINS="$ROOT/nes-plugins/CMakeLists.txt" +IMAGE="${NES_DEV_IMAGE:-localhost/nes-development:mobilitynebula-v3}" +BUILD_DIR="${BUILD_DIR:-build-w15}" +TARGETS="${*:-nes-physical-operators nes-logical-operators nes-sql-parser}" + +restore() { git -C "$ROOT" checkout -- "$PLUGINS" 2>/dev/null || true; } +trap restore EXIT + +# Disable the optional MQTT plugins for the local configure (absent in this image). +sed -i 's#"Sources/MQTTSource" ON)#"Sources/MQTTSource" OFF)#; s#"Sinks/MQTTSink" ON)#"Sinks/MQTTSink" OFF)#' "$PLUGINS" + +podman run --rm -v "$ROOT":/workspace -w /workspace "$IMAGE" \ + bash -lc "cmake --build '$BUILD_DIR' --target $TARGETS -j 8 -- -k 0; echo \"### EXIT=\$?\"" diff --git a/tools/codegen/codegen_aggregations.py b/tools/codegen/codegen_aggregations.py new file mode 100644 index 0000000000..e2b1e86bb8 --- /dev/null +++ b/tools/codegen/codegen_aggregations.py @@ -0,0 +1,2745 @@ +#!/usr/bin/env python3 +"""MobilityNebula MEOS-aggregation generator. + +Companion to ``codegen_nebula.py`` (per-event ops). This generator targets +the WINDOWED-aggregation surface: MEOS scalar functions of the shape +`` fn(const Temporal*)`` where the Temporal* is a per-(window, +group) sequence assembled across multiple events. + +For each operator in the JSON descriptor list, emits four C++ files +mirroring mariana's hand-written TemporalLengthAggregation 1:1: + + * nes-logical-operators/include/Operators/Windows/Aggregations/Meos/ + XXXAggregationLogicalFunction.hpp + * nes-logical-operators/src/Operators/Windows/Aggregations/Meos/ + XXXAggregationLogicalFunction.cpp + * nes-physical-operators/include/Aggregation/Function/Meos/ + XXXAggregationPhysicalFunction.hpp + * nes-physical-operators/src/Aggregation/Function/Meos/ + XXXAggregationPhysicalFunction.cpp + +And idempotently injects into 5 in-tree shared files: + + * nes-sql-parser/AntlrSQL.g4 + - lexer-token entries + - functionName: alternation list + * nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp + - case AntlrSQLLexer::TOKEN: dispatch in the dedicated-token switch + - else if (funcName == "TOKEN") dispatch in the IDENTIFIER fallback chain + * nes-query-optimizer/src/RewriteRules/LowerToPhysical/ + LowerToPhysicalWindowedAggregation.cpp + - if (name == "Xxx") { ... } block lowering logical → physical + * nes-{logical,physical}-operators/.../{Aggregation*}/CMakeLists.txt + - add_plugin(...) per layer + +All injections are bracketed with +``/* BEGIN CODEGEN AGGREGATION GLUE: TOKEN */ ... /* END ... */`` markers +so re-runs are no-ops and pre-existing hand-written cases (mariana's) are +detected by raw token match and skipped. + +Two lift-shape branches, picked by descriptor ``input_shape``: + * ``tgeo`` — 3 fields per event (lon, lat, ts); lower builds + ``{Point(lon lat)@ts, ...}`` trajectory string parsed via + ``MEOS::Meos::parseTemporalPoint``. + * ``tnumber``— 2 fields per event (value, ts); lower builds + ``{value@ts, ...}`` string parsed via ``tfloat_in`` or + ``tint_in`` per descriptor. + +Usage: + python3 codegen_aggregations.py --input \\ + --output-root /path/to/MobilityNebula \\ + [--no-parser-glue] [--no-cmake-entries] [--no-optimizer-glue] +""" +import argparse +import json +import re +import sys +from pathlib import Path + +# =========================================================================== +# Logical-layer .hpp template (mirrors TemporalLengthAggregationLogicalFunction.hpp). +# =========================================================================== +LOGICAL_HPP_TGEO = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{{ + +/** + * @brief {comment_one_liner} + * + * Three-input (lon, lat, ts) tgeo aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) trajectory + * and calls MEOS `{meos_scalar_fn}` to fold it to a single scalar. + */ +class {nebula_name}AggregationLogicalFunction : public WindowAggregationLogicalFunction +{{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& lonField, const FieldAccessLogicalFunction& latField, const FieldAccessLogicalFunction& timestampField); + + {nebula_name}AggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~{nebula_name}AggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const {{ return true; }} + + [[nodiscard]] const FieldAccessLogicalFunction& getLonField() const noexcept {{ return lonField; }} + [[nodiscard]] const FieldAccessLogicalFunction& getLatField() const noexcept {{ return latField; }} + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept {{ return timestampField; }} + +private: + static constexpr std::string_view NAME = "{class_name_token}"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::{final_stamp_type}; + + FieldAccessLogicalFunction lonField; + FieldAccessLogicalFunction latField; + FieldAccessLogicalFunction timestampField; +}}; +}} +""" + +LOGICAL_HPP_TNUMBER = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include + +namespace NES +{{ + +/** + * @brief {comment_one_liner} + * + * Two-input (value, ts) tnumber aggregation. Lift accumulates the events + * into a paged vector; lower assembles the per-(window, group) tnumber + * sequence and calls MEOS `{meos_scalar_fn}` to fold it to a single scalar. + */ +class {nebula_name}AggregationLogicalFunction : public WindowAggregationLogicalFunction +{{ +public: + static std::shared_ptr + create(const FieldAccessLogicalFunction& valueField, const FieldAccessLogicalFunction& timestampField); + + {nebula_name}AggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField); + + void inferStamp(const Schema& schema) override; + ~{nebula_name}AggregationLogicalFunction() override = default; + [[nodiscard]] NES::SerializableAggregationFunction serialize() const override; + [[nodiscard]] std::string_view getName() const noexcept override; + [[nodiscard]] bool requiresSequentialAggregation() const {{ return true; }} + + [[nodiscard]] const FieldAccessLogicalFunction& getValueField() const noexcept {{ return valueField; }} + [[nodiscard]] const FieldAccessLogicalFunction& getTimestampField() const noexcept {{ return timestampField; }} + +private: + static constexpr std::string_view NAME = "{class_name_token}"; + static constexpr DataType::Type partialAggregateStampType = DataType::Type::UNDEFINED; + static constexpr DataType::Type finalAggregateStampType = DataType::Type::{final_stamp_type}; + + FieldAccessLogicalFunction valueField; + FieldAccessLogicalFunction timestampField; +}}; +}} +""" + +# Logical .cpp templates — share scaffold (ctor, inferStamp, serialize, registry) +# but differ in field count (3 for tgeo, 2 for tnumber). +LOGICAL_CPP_TGEO = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{{ + +{nebula_name}AggregationLogicalFunction::{nebula_name}AggregationLogicalFunction( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + lonField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + lonField, + asField) + , lonField(lonField) + , latField(latField) + , timestampField(timestampField) +{{ +}} + +std::shared_ptr +{nebula_name}AggregationLogicalFunction::create( + const FieldAccessLogicalFunction& lonField, + const FieldAccessLogicalFunction& latField, + const FieldAccessLogicalFunction& timestampField) +{{ + return std::make_shared<{nebula_name}AggregationLogicalFunction>(lonField, latField, timestampField, lonField); +}} + +std::string_view {nebula_name}AggregationLogicalFunction::getName() const noexcept +{{ + return NAME; +}} + +void {nebula_name}AggregationLogicalFunction::inferStamp(const Schema& schema) +{{ + lonField = lonField.withInferredDataType(schema).get(); + latField = latField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = lonField; + + if (!lonField.getDataType().isNumeric() || !latField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + {{ + throw CannotInferSchema("{nebula_name}AggregationLogicalFunction: lon, lat, and timestamp fields must be numeric."); + }} + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + {{ + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + }} + else + {{ + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + }} + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +}} + +NES::SerializableAggregationFunction {nebula_name}AggregationLogicalFunction::serialize() const +{{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(lonField, latField, timestampField, asField); + saf.set_type(std::string(NAME)); + return saf; +}} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::Register{nebula_name}AggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{{ + if (arguments.fields.size() == 4) + {{ + auto ptr = std::make_shared<{nebula_name}AggregationLogicalFunction>( + arguments.fields[0], arguments.fields[1], arguments.fields[2], arguments.fields[3]); + return ptr; + }} + throw CannotDeserialize( + "{nebula_name}AggregationLogicalFunction requires lon, lat, timestamp, and alias fields but got {{}}", + arguments.fields.size()); +}} + +}} // namespace NES +""" + +LOGICAL_CPP_TNUMBER = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace NES +{{ + +{nebula_name}AggregationLogicalFunction::{nebula_name}AggregationLogicalFunction( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField, + const FieldAccessLogicalFunction& asField) + : WindowAggregationLogicalFunction( + valueField.getDataType(), + DataTypeProvider::provideDataType(partialAggregateStampType), + DataTypeProvider::provideDataType(finalAggregateStampType), + valueField, + asField) + , valueField(valueField) + , timestampField(timestampField) +{{ +}} + +std::shared_ptr +{nebula_name}AggregationLogicalFunction::create( + const FieldAccessLogicalFunction& valueField, + const FieldAccessLogicalFunction& timestampField) +{{ + return std::make_shared<{nebula_name}AggregationLogicalFunction>(valueField, timestampField, valueField); +}} + +std::string_view {nebula_name}AggregationLogicalFunction::getName() const noexcept +{{ + return NAME; +}} + +void {nebula_name}AggregationLogicalFunction::inferStamp(const Schema& schema) +{{ + valueField = valueField.withInferredDataType(schema).get(); + timestampField = timestampField.withInferredDataType(schema).get(); + + onField = valueField; + + if (!valueField.getDataType().isNumeric() || !timestampField.getDataType().isNumeric()) + {{ + throw CannotInferSchema("{nebula_name}AggregationLogicalFunction: value and timestamp fields must be numeric."); + }} + + const auto onFieldName = onField.getFieldName(); + const auto asFieldName = asField.getFieldName(); + const auto attributeNameResolver = onFieldName.substr(0, onFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + if (asFieldName.find(Schema::ATTRIBUTE_NAME_SEPARATOR) == std::string::npos) + {{ + asField = asField.withFieldName(attributeNameResolver + asFieldName).get(); + }} + else + {{ + const auto fieldName = asFieldName.substr(asFieldName.find_last_of(Schema::ATTRIBUTE_NAME_SEPARATOR) + 1); + asField = asField.withFieldName(attributeNameResolver + fieldName).get(); + }} + asField = asField.withDataType(getFinalAggregateStamp()).get(); + inputStamp = onField.getDataType(); +}} + +NES::SerializableAggregationFunction {nebula_name}AggregationLogicalFunction::serialize() const +{{ + auto saf = TemporalAggregationSerde::serializeTemporalSequence(valueField, timestampField, valueField, asField); + saf.set_type(std::string(NAME)); + return saf; +}} + +AggregationLogicalFunctionRegistryReturnType AggregationLogicalFunctionGeneratedRegistrar::Register{nebula_name}AggregationLogicalFunction( + AggregationLogicalFunctionRegistryArguments arguments) +{{ + // serializeTemporalSequence only has a 4-field (lon, lat, ts, as) form, so + // the two-field (value, ts) shape packs the value field twice; fields[2] is + // that duplicate and is ignored here — the alias is fields[3]. + if (arguments.fields.size() == 4) + {{ + auto ptr = std::make_shared<{nebula_name}AggregationLogicalFunction>( + arguments.fields[0], arguments.fields[1], arguments.fields[3]); + return ptr; + }} + throw CannotDeserialize( + "{nebula_name}AggregationLogicalFunction requires value, timestamp, and alias fields but got {{}}", + arguments.fields.size()); +}} + +}} // namespace NES +""" + +# Physical-layer .hpp templates. +PHYSICAL_HPP_TGEO = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{{ + +class {nebula_name}AggregationPhysicalFunction : public AggregationPhysicalFunction +{{ +public: + {nebula_name}AggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~{nebula_name}AggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction lonFunction; + PhysicalFunction latFunction; + PhysicalFunction timestampFunction; +}}; + +}} +""" + +PHYSICAL_HPP_TNUMBER = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace NES +{{ + +class {nebula_name}AggregationPhysicalFunction : public AggregationPhysicalFunction +{{ +public: + {nebula_name}AggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef); + void lift( + const nautilus::val& aggregationState, + PipelineMemoryProvider& pipelineMemoryProvider, + const Nautilus::Record& record) + override; + void combine( + nautilus::val aggregationState1, + nautilus::val aggregationState2, + PipelineMemoryProvider& pipelineMemoryProvider) override; + Nautilus::Record lower(nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) override; + void reset(nautilus::val aggregationState, PipelineMemoryProvider& pipelineMemoryProvider) override; + [[nodiscard]] size_t getSizeOfStateInBytes() const override; + ~{nebula_name}AggregationPhysicalFunction() override = default; + void cleanup(nautilus::val aggregationState) override; + +private: + std::shared_ptr bufferRef; + PhysicalFunction valueFunction; + PhysicalFunction timestampFunction; +}}; + +}} +""" + +# Physical .cpp templates — the core logic. lift/combine/reset/cleanup are identical +# scaffold; lower() is the per-op differential (builds trajectory string + MEOS call). +PHYSICAL_CPP_TGEO = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" {{ +#include +#include +}} + +namespace NES +{{ + +constexpr static std::string_view LonFieldName = "lon"; +constexpr static std::string_view LatFieldName = "lat"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex {mutex_name}; + + +{nebula_name}AggregationPhysicalFunction::{nebula_name}AggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{{ +}} + +void {nebula_name}AggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({{ + {{std::string(LonFieldName), lonValue}}, + {{std::string(LatFieldName), latValue}}, + {{std::string(TimestampFieldName), timestampValue}} + }}); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +}} + +void {nebula_name}AggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + {{ vector1->copyFrom(*vector2); }}, + memArea1, + memArea2); +}} + +Nautilus::Record {nebula_name}AggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + {{ + return pagedVector->getTotalNumberOfEntries(); + }}, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) {{ + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val<{return_cpp_type}>(0)); + return resultRecord; + }} + + auto trajectoryStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + {{ + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 150 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{{"); + return buffer; + }}, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + {{ + const auto itemRecord = *candidateIt; + + const auto lonValue = itemRecord.read(std::string(LonFieldName)); + const auto latValue = itemRecord.read(std::string(LatFieldName)); + const auto timestampValue = itemRecord.read(std::string(TimestampFieldName)); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + trajectoryStr = nautilus::invoke( + +[](char* buffer, double lonVal, double latVal, int64_t tsVal, int64_t counter) -> char* + {{ + if (counter > 0) {{ + strcat(buffer, ", "); + }} + + long long adjustedTime; + if (tsVal > 1000000000000LL) {{ + adjustedTime = tsVal / 1000; + }} else {{ + adjustedTime = tsVal; + }} + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char pointStr[120]; + sprintf(pointStr, "Point(%.6f %.6f)@%s", lonVal, latVal, timestampStr); + strcat(buffer, pointStr); + return buffer; + }}, + trajectoryStr, + lon, + lat, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + }} + + trajectoryStr = nautilus::invoke( + +[](char* buffer) -> char* + {{ + strcat(buffer, "}}"); + return buffer; + }}, + trajectoryStr); + + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> {return_cpp_type} + {{ + if (!trajStr || strlen(trajStr) == 0) {{ + free((void*)trajStr); + return ({return_cpp_type})0; + }} + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) {{ + free((void*)trajStr); + return ({return_cpp_type})0; + }} + + {value_compute} + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }}, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +}} + +void {nebula_name}AggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + {{ + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }}, + aggregationState); +}} + +size_t {nebula_name}AggregationPhysicalFunction::getSizeOfStateInBytes() const +{{ + return sizeof(Nautilus::Interface::PagedVector); +}} + +void {nebula_name}AggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + {{ + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }}, + aggregationState); +}} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::Register{nebula_name}AggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{{ + throw std::runtime_error("{class_name_token} aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +}} + +}} // namespace NES +""" + +PHYSICAL_CPP_TNUMBER = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" {{ +#include +}} + +namespace NES +{{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex {mutex_name}; + + +{nebula_name}AggregationPhysicalFunction::{nebula_name}AggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{{ +}} + +void {nebula_name}AggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({{ + {{std::string(ValueFieldName), valueValue}}, + {{std::string(TimestampFieldName), timestampValue}} + }}); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +}} + +void {nebula_name}AggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + {{ vector1->copyFrom(*vector2); }}, + memArea1, + memArea2); +}} + +Nautilus::Record {nebula_name}AggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + {{ + return pagedVector->getTotalNumberOfEntries(); + }}, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) {{ + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val<{return_cpp_type}>(0)); + return resultRecord; + }} + + auto sequenceStr = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) -> char* + {{ + size_t bufferSize = pagedVector->getTotalNumberOfEntries() * 80 + 50; + char* buffer = (char*)malloc(bufferSize); + memset(buffer, 0, bufferSize); + strcpy(buffer, "{{"); + return buffer; + }}, + pagedVectorPtr); + + auto pointCounter = nautilus::val(0); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + {{ + const auto itemRecord = *candidateIt; + + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + const auto timestampRaw = itemRecord.read(std::string(TimestampFieldName)); + + auto value = valueRaw.cast>(); + auto timestamp = timestampRaw.cast>(); + + sequenceStr = nautilus::invoke( + +[](char* buffer, {lift_value_cpp_type} valueVal, int64_t tsVal, int64_t counter) -> char* + {{ + if (counter > 0) {{ + strcat(buffer, ", "); + }} + + long long adjustedTime; + if (tsVal > 1000000000000LL) {{ + adjustedTime = tsVal / 1000; + }} else {{ + adjustedTime = tsVal; + }} + + std::string timestampString = MEOS::Meos::convertSecondsToTimestamp(adjustedTime); + const char* timestampStr = timestampString.c_str(); + + char itemStr[80]; + sprintf(itemStr, "{value_printf_fmt}@%s", valueVal, timestampStr); + strcat(buffer, itemStr); + return buffer; + }}, + sequenceStr, + value, + timestamp, + pointCounter); + + pointCounter = pointCounter + nautilus::val(1); + }} + + sequenceStr = nautilus::invoke( + +[](char* buffer) -> char* + {{ + strcat(buffer, "}}"); + return buffer; + }}, + sequenceStr); + + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> {return_cpp_type} + {{ + if (!seqStr || strlen(seqStr) == 0) {{ + free((void*)seqStr); + return ({return_cpp_type})0; + }} + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + + Temporal* temp = {tnumber_in_fn}(seqStr); + if (!temp) {{ + free((void*)seqStr); + return ({return_cpp_type})0; + }} + + {return_cpp_type} value = {meos_scalar_fn}(temp); + + free(temp); + free((void*)seqStr); + return value; + }}, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +}} + +void {nebula_name}AggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + {{ + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }}, + aggregationState); +}} + +size_t {nebula_name}AggregationPhysicalFunction::getSizeOfStateInBytes() const +{{ + return sizeof(Nautilus::Interface::PagedVector); +}} + +void {nebula_name}AggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + {{ + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }}, + aggregationState); +}} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::Register{nebula_name}AggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{{ + throw std::runtime_error("{class_name_token} aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +}} + +}} // namespace NES +""" + +# =========================================================================== +# Box-output (VARSIZED) physical .cpp templates. +# +# The 11 MEOS `*_extent_transfn` aggregates do not fold a window to a scalar — +# they fold it to a *box* (a Span / TBox / STBox). NebulaStream emits such a +# windowed value through the same variable-sized-data path that +# TemporalSequenceAggregationPhysicalFunction already uses: in lower() we +# serialize the box to text (`*_out`) and write it as VARSIZED. +# +# To stay byte-identical to the proven scalar templates above (lift / combine / +# reset / cleanup / the trajectory-assembly loop are unchanged), the box +# templates are DERIVED from the scalar templates by swapping exactly two +# well-delimited regions: the empty-window early-return and the finalize tail. +# The swap is asserted (count == 1) so any drift in the scalar template fails +# loudly at import time rather than emitting silently-wrong C++. +# =========================================================================== + +# Empty-window early-return — identical in the TGEO and TNUMBER scalar templates. +_EMPTY_SCALAR = """\ + if (numberOfEntries == nautilus::val(0)) {{ + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, nautilus::val<{return_cpp_type}>(0)); + return resultRecord; + }}""" + +_EMPTY_BOX = """\ + if (numberOfEntries == nautilus::val(0)) {{ + auto emptyVarSized = pipelineMemoryProvider.arena.allocateVariableSizedData(0); + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, emptyVarSized); + return resultRecord; + }}""" + +# Finalize tail — TGEO scalar (parseTemporalPoint / trajectoryStr / freeTemporalObject). +_FINALIZE_SCALAR_TGEO = """\ + auto resultValue = nautilus::invoke( + +[](const char* trajStr) -> {return_cpp_type} + {{ + if (!trajStr || strlen(trajStr) == 0) {{ + free((void*)trajStr); + return ({return_cpp_type})0; + }} + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + if (!temp) {{ + free((void*)trajStr); + return ({return_cpp_type})0; + }} + + {value_compute} + + MEOS::Meos::freeTemporalObject(temp); + free((void*)trajStr); + return value; + }}, + trajectoryStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord;""" + +# Finalize tail — TGEO box: fold the windowed trajectory's extent box and emit +# its serialized text as VARSIZED. With a NULL initial state the MEOS extent +# transition fn returns the bbox of the whole-window temporal (e.g. +# tspatial_extent_transfn(NULL, traj) == tspatial_to_stbox(traj)). +_FINALIZE_BOX_TGEO = """\ + auto boxStr = nautilus::invoke( + +[](const char* trajStr) -> char* + {{ + if (!trajStr || strlen(trajStr) == 0) {{ + free((void*)trajStr); + return (char*)nullptr; + }} + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + free((void*)trajStr); + if (!temp) {{ + return (char*)nullptr; + }} + + {extent_box_type}* aggBox = {extent_transfn}(nullptr, static_cast(temp)); + MEOS::Meos::freeTemporalObject(temp); + if (!aggBox) {{ + return (char*)nullptr; + }} + + char* boxText = {box_out_fn}(aggBox, 15); + free(aggBox); + return boxText; + }}, + trajectoryStr); + + const auto boxStrLen = nautilus::invoke( + +[](const char* s) -> size_t {{ return s ? strlen(s) : (size_t) 0; }}, + boxStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxStrLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + {{ + if (s) {{ + memcpy(dest, s, len); + free((void*)s); + }} + }}, + variableSized.getContent(), + boxStr, + boxStrLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord;""" + +# Finalize tail — TNUMBER scalar ({tnumber_in_fn} / sequenceStr / free(temp)). +_FINALIZE_SCALAR_TNUMBER = """\ + auto resultValue = nautilus::invoke( + +[](const char* seqStr) -> {return_cpp_type} + {{ + if (!seqStr || strlen(seqStr) == 0) {{ + free((void*)seqStr); + return ({return_cpp_type})0; + }} + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + + Temporal* temp = {tnumber_in_fn}(seqStr); + if (!temp) {{ + free((void*)seqStr); + return ({return_cpp_type})0; + }} + + {return_cpp_type} value = {meos_scalar_fn}(temp); + + free(temp); + free((void*)seqStr); + return value; + }}, + sequenceStr); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord;""" + +# Finalize tail — TNUMBER box. +_FINALIZE_BOX_TNUMBER = """\ + auto boxStr = nautilus::invoke( + +[](const char* seqStr) -> char* + {{ + if (!seqStr || strlen(seqStr) == 0) {{ + free((void*)seqStr); + return (char*)nullptr; + }} + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + + Temporal* temp = {tnumber_in_fn}(seqStr); + free((void*)seqStr); + if (!temp) {{ + return (char*)nullptr; + }} + + {extent_box_type}* aggBox = {extent_transfn}(nullptr, temp); + free(temp); + if (!aggBox) {{ + return (char*)nullptr; + }} + + char* boxText = {box_out_fn}(aggBox, 15); + free(aggBox); + return boxText; + }}, + sequenceStr); + + const auto boxStrLen = nautilus::invoke( + +[](const char* s) -> size_t {{ return s ? strlen(s) : (size_t) 0; }}, + boxStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxStrLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + {{ + if (s) {{ + memcpy(dest, s, len); + free((void*)s); + }} + }}, + variableSized.getContent(), + boxStr, + boxStrLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord;""" + + +def _swap_once(template, old, new, what): + """Replace exactly one occurrence of `old` with `new`, asserting the count + so a drifted scalar template fails at import rather than emitting bad C++.""" + n = template.count(old) + if n != 1: + raise AssertionError( + f"box-template derivation: expected exactly 1 occurrence of {what}, found {n}") + return template.replace(old, new) + + +PHYSICAL_CPP_TGEO_BOX = _swap_once( + _swap_once(PHYSICAL_CPP_TGEO, _EMPTY_SCALAR, _EMPTY_BOX, "tgeo empty-window block"), + _FINALIZE_SCALAR_TGEO, _FINALIZE_BOX_TGEO, "tgeo finalize tail") + +PHYSICAL_CPP_TNUMBER_BOX = _swap_once( + _swap_once(PHYSICAL_CPP_TNUMBER, _EMPTY_SCALAR, _EMPTY_BOX, "tnumber empty-window block"), + _FINALIZE_SCALAR_TNUMBER, _FINALIZE_BOX_TNUMBER, "tnumber finalize tail") + +# =========================================================================== +# WKB-trajectory output (return_mode "wkb"): materialize the windowed mini-trip +# as a SEQUENCE ([ ... ], linear interpolation — so trajectory functions like +# length are meaningful) and emit its hex-WKB. This is the value the MEOS +# function library composes over (the efficient materialize-once mechanism). +# Derived from the tgeo scalar template by swapping the empty-window write, the +# instant-set braces for sequence brackets, and the finalize. +# =========================================================================== +_FINALIZE_WKB_TGEO = """\ + auto boxStr = nautilus::invoke( + +[](const char* trajStr) -> char* + {{ + if (!trajStr || strlen(trajStr) == 0) {{ + free((void*)trajStr); + return (char*)nullptr; + }} + + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + + std::string trajString(trajStr); + void* temp = MEOS::Meos::parseTemporalPoint(trajString); + free((void*)trajStr); + if (!temp) {{ + return (char*)nullptr; + }} + + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(static_cast(temp), 0, &hexSize); + MEOS::Meos::freeTemporalObject(temp); + return hexOut; + }}, + trajectoryStr); + + const auto boxStrLen = nautilus::invoke( + +[](const char* s) -> size_t {{ return s ? strlen(s) : (size_t) 0; }}, + boxStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxStrLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + {{ + if (s) {{ + memcpy(dest, s, len); + free((void*)s); + }} + }}, + variableSized.getContent(), + boxStr, + boxStrLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord;""" + +PHYSICAL_CPP_TGEO_WKB = _swap_once( + _swap_once( + _swap_once( + _swap_once(PHYSICAL_CPP_TGEO, _EMPTY_SCALAR, _EMPTY_BOX, "tgeo-wkb empty-window block"), + ' strcpy(buffer, "{{");', ' strcpy(buffer, "[");', "tgeo-wkb open bracket -> sequence"), + ' strcat(buffer, "}}");', ' strcat(buffer, "]");', "tgeo-wkb close bracket -> sequence"), + _FINALIZE_SCALAR_TGEO, _FINALIZE_WKB_TGEO, "tgeo-wkb finalize tail") + +# =========================================================================== +# Expandable-Temporal* aggregate (return_mode "expand"): the MEOS-native +# streaming model — the aggregate STATE is a live expandable `Temporal*` (a +# mini-trip trajectory), grown in place per event via the public streaming +# primitive `temporal_append_tinstant(..., expand=true)` (amortized-O(1), +# doubling). lower() applies the invariant MEOS scalar fn DIRECTLY to the live +# trajectory — no per-event string build, no parse-the-whole-window, no WKB. +# State is a `Temporal*` slot (sizeof(Temporal*)); public funcs only +# (tgeompoint_in / tsequence_make / temporal_append_tinstant / temporal_merge). +# =========================================================================== +PHYSICAL_CPP_TGEO_EXPAND = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" {{ +#include +#include +}} + +namespace NES +{{ + +static std::mutex {mutex_name}; + + +{nebula_name}AggregationPhysicalFunction::{nebula_name}AggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{{ +}} + +void {nebula_name}AggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{{ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) {{ + return; + }} + if (*slot == nullptr) {{ + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + }} else {{ + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + }} + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }}, + aggregationState, + lon, + lat, + timestamp); +}} + +void {nebula_name}AggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{{ + nautilus::invoke( + +[](AggregationState* st1, AggregationState* st2) -> void + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Temporal** s1 = reinterpret_cast(st1); + Temporal** s2 = reinterpret_cast(st2); + if (*s2 == nullptr) {{ + return; + }} + if (*s1 == nullptr) {{ + *s1 = *s2; + *s2 = nullptr; + return; + }} + // temporal_merge returns a fresh temporal (copies inputs, frees nothing). + Temporal* merged = temporal_merge(*s1, *s2); + free(*s1); + free(*s2); + *s2 = nullptr; + *s1 = merged; + }}, + aggregationState1, + aggregationState2); +}} + +Nautilus::Record {nebula_name}AggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{{ + MEOS::Meos::ensureMeosInitialized(); + + auto resultValue = nautilus::invoke( + +[](AggregationState* st) -> {return_cpp_type} + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) {{ + return ({return_cpp_type})0; + }} + return {meos_scalar_fn}(*slot); + }}, + aggregationState); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord; +}} + +void {nebula_name}AggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{{ + nautilus::invoke( + +[](AggregationState* st) -> void + {{ + Temporal** slot = reinterpret_cast(st); + *slot = nullptr; + }}, + aggregationState); +}} + +size_t {nebula_name}AggregationPhysicalFunction::getSizeOfStateInBytes() const +{{ + return sizeof(Temporal*); +}} + +void {nebula_name}AggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{{ + nautilus::invoke( + +[](AggregationState* st) -> void + {{ + Temporal** slot = reinterpret_cast(st); + if (*slot != nullptr) {{ + free(*slot); + *slot = nullptr; + }} + }}, + aggregationState); +}} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::Register{nebula_name}AggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{{ + throw std::runtime_error("{class_name_token} aggregation cannot be created through the registry. " + "It requires three field functions (longitude, latitude, timestamp)"); +}} + +}} // namespace NES +""" + +# =========================================================================== +# Scalar-fold box-output template (value/time Span extents). +# +# Reuses the tnumber (value, ts) HPP / ctor / lift / combine / reset / cleanup +# verbatim — only lower() differs. There is NO trajectory/sequence string and +# NO MEOS parse: the chosen scalar field is folded DIRECTLY through the MEOS +# extent transition fn (`float_extent_transfn`, `timestamptz_extent_transfn`, +# …), the Span state threading across events as an opaque pointer (NULL initial +# state -> first call allocates via span_make, later calls span_expand in place; +# one allocation total, freed after serialization via the external typed +# wrapper `floatspan_out` / `intspan_out` / `bigintspan_out` / `tstzspan_out`). +# =========================================================================== +PHYSICAL_CPP_SCALARFOLD = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +extern "C" {{ +#include +}} + +namespace NES +{{ + +constexpr static std::string_view ValueFieldName = "value"; +constexpr static std::string_view TimestampFieldName = "timestamp"; + +static std::mutex {mutex_name}; + + +{nebula_name}AggregationPhysicalFunction::{nebula_name}AggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{{ +}} + +void {nebula_name}AggregationPhysicalFunction::lift( + const nautilus::val& aggregationState, PipelineMemoryProvider& pipelineMemoryProvider, const Nautilus::Record& record) +{{ + const auto pagedVectorPtr = static_cast>(aggregationState); + + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + Record aggregateStateRecord({{ + {{std::string(ValueFieldName), valueValue}}, + {{std::string(TimestampFieldName), timestampValue}} + }}); + + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + pagedVectorRef.writeRecord(aggregateStateRecord, pipelineMemoryProvider.bufferProvider); +}} + +void {nebula_name}AggregationPhysicalFunction::combine( + const nautilus::val aggregationState1, + const nautilus::val aggregationState2, + PipelineMemoryProvider&) +{{ + const auto memArea1 = static_cast>(aggregationState1); + const auto memArea2 = static_cast>(aggregationState2); + + nautilus::invoke( + +[](Nautilus::Interface::PagedVector* vector1, const Nautilus::Interface::PagedVector* vector2) -> void + {{ vector1->copyFrom(*vector2); }}, + memArea1, + memArea2); +}} + +Nautilus::Record {nebula_name}AggregationPhysicalFunction::lower( + const nautilus::val aggregationState, [[maybe_unused]] PipelineMemoryProvider& pipelineMemoryProvider) +{{ + MEOS::Meos::ensureMeosInitialized(); + + const auto pagedVectorPtr = static_cast>(aggregationState); + const Nautilus::Interface::PagedVectorRef pagedVectorRef(pagedVectorPtr, bufferRef); + const auto allFieldNames = bufferRef->getMemoryLayout()->getSchema().getFieldNames(); + const auto numberOfEntries = invoke( + +[](const Nautilus::Interface::PagedVector* pagedVector) + {{ + return pagedVector->getTotalNumberOfEntries(); + }}, + pagedVectorPtr); + + if (numberOfEntries == nautilus::val(0)) {{ + auto emptyVarSized = pipelineMemoryProvider.arena.allocateVariableSizedData(0); + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, emptyVarSized); + return resultRecord; + }} + + // Fold the windowed scalar field through the MEOS extent transition fn. + // The Span state threads across events as an opaque pointer; a NULL initial + // state makes the first call allocate, later calls expand in place. + auto spanState = nautilus::invoke( + +[](const Nautilus::Interface::PagedVector*) -> void* {{ return nullptr; }}, + pagedVectorPtr); + + const auto endIt = pagedVectorRef.end(allFieldNames); + for (auto candidateIt = pagedVectorRef.begin(allFieldNames); candidateIt != endIt; ++candidateIt) + {{ + const auto itemRecord = *candidateIt; + const auto valueRaw = itemRecord.read(std::string(ValueFieldName)); + auto value = valueRaw.cast>(); + + spanState = nautilus::invoke( + +[](void* state, {fold_field_cpp_type} val) -> void* + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + {fold_invoke_body} + }}, + spanState, + value); + }} + + auto boxStr = nautilus::invoke( + +[](void* state) -> char* + {{ + if (!state) {{ + return (char*)nullptr; + }} + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Span* sp = static_cast(state); + char* out = {box_out_call}; + free(state); + return out; + }}, + spanState); + + const auto boxStrLen = nautilus::invoke( + +[](const char* s) -> size_t {{ return s ? strlen(s) : (size_t) 0; }}, + boxStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(boxStrLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + {{ + if (s) {{ + memcpy(dest, s, len); + free((void*)s); + }} + }}, + variableSized.getContent(), + boxStr, + boxStrLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord; +}} + +void {nebula_name}AggregationPhysicalFunction::reset(const nautilus::val aggregationState, PipelineMemoryProvider&) +{{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + {{ + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + new (pagedVector) Nautilus::Interface::PagedVector(); + }}, + aggregationState); +}} + +size_t {nebula_name}AggregationPhysicalFunction::getSizeOfStateInBytes() const +{{ + return sizeof(Nautilus::Interface::PagedVector); +}} + +void {nebula_name}AggregationPhysicalFunction::cleanup(nautilus::val aggregationState) +{{ + nautilus::invoke( + +[](AggregationState* pagedVectorMemArea) -> void + {{ + auto* pagedVector = reinterpret_cast(pagedVectorMemArea); + pagedVector->~PagedVector(); + }}, + aggregationState); +}} + + +AggregationPhysicalFunctionRegistryReturnType AggregationPhysicalFunctionGeneratedRegistrar::Register{nebula_name}AggregationPhysicalFunction( + AggregationPhysicalFunctionRegistryArguments) +{{ + throw std::runtime_error("{class_name_token} aggregation cannot be created through the registry. " + "It requires two field functions (value, timestamp)"); +}} + +}} // namespace NES +""" + +# =========================================================================== +# Set-collect aggregate template (windowed union -> Set). +# +# Same scalar-fold mechanism as PHYSICAL_CPP_SCALARFOLD, but the per-event +# `*_union_transfn` accumulates an unordered Set state (not a Span); the window +# is finalized with `set_union_finalfn` into the canonical Set before +# serialization through an external typed wrapper (floatset_out / intset_out / +# bigintset_out / tstzset_out). Derived from the scalar-fold template by an +# asserted swap of only the serialize lambda — the fold loop / lift / combine / +# reset / cleanup stay byte-identical. +# =========================================================================== +_SCALARFOLD_SERIALIZE_SPAN = """\ + auto boxStr = nautilus::invoke( + +[](void* state) -> char* + {{ + if (!state) {{ + return (char*)nullptr; + }} + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Span* sp = static_cast(state); + char* out = {box_out_call}; + free(state); + return out; + }}, + spanState);""" + +_SCALARFOLD_SERIALIZE_SET = """\ + auto boxStr = nautilus::invoke( + +[](void* state) -> char* + {{ + if (!state) {{ + return (char*)nullptr; + }} + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + // set_union_finalfn pfree()s the state internally and returns a new + // Set, so the state must NOT be freed again here (double free). + Set* sp = {finalfn}(static_cast(state)); + if (!sp) {{ + return (char*)nullptr; + }} + char* out = {box_out_call}; + free(sp); + return out; + }}, + spanState);""" + +PHYSICAL_CPP_SETFOLD = _swap_once( + PHYSICAL_CPP_SCALARFOLD, _SCALARFOLD_SERIALIZE_SPAN, _SCALARFOLD_SERIALIZE_SET, + "scalarfold serialize -> setfold (finalfn)") + +# =========================================================================== +# Parser-glue templates: TWO dispatch sites in AntlrSQLQueryPlanCreator.cpp. +# Site 1 is the dedicated-token case-switch (~line 965 in mariana's tree). +# Site 2 is the IDENTIFIER fallback `else if (funcName == "TOKEN")` chain +# (~line 2062 in mariana's tree). +# =========================================================================== + +# Site 1 — case-switch dispatch. Two shapes (tgeo 3-arg, tnumber 2-arg). +CASE_SWITCH_TGEO = """\ + /* BEGIN CODEGEN AGGREGATION GLUE: {sql_token} (case-switch) */ + case AntlrSQLLexer::{sql_token}: + // {comment_one_liner} + if (helpers.top().functionBuilder.size() != 3) {{ + throw InvalidQuerySyntax("{sql_token} requires exactly three arguments (longitude, latitude, timestamp), but got {{}}", helpers.top().functionBuilder.size()); + }} + {{ + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto latitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto longitudeFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!longitudeFunction.tryGet() || + !latitudeFunction.tryGet() || + !timestampFunction.tryGet()) {{ + throw InvalidQuerySyntax("{sql_token} arguments must be field references"); + }} + + helpers.top().windowAggs.push_back( + {nebula_name}AggregationLogicalFunction::create(longitudeFunction.get(), + latitudeFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(longitudeFunction); + }} + break; + /* END CODEGEN AGGREGATION GLUE: {sql_token} (case-switch) */ +""" + +CASE_SWITCH_TNUMBER = """\ + /* BEGIN CODEGEN AGGREGATION GLUE: {sql_token} (case-switch) */ + case AntlrSQLLexer::{sql_token}: + // {comment_one_liner} + if (helpers.top().functionBuilder.size() != 2) {{ + throw InvalidQuerySyntax("{sql_token} requires exactly two arguments (value, timestamp), but got {{}}", helpers.top().functionBuilder.size()); + }} + {{ + const auto timestampFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + const auto valueFunction = helpers.top().functionBuilder.back(); + helpers.top().functionBuilder.pop_back(); + + if (!valueFunction.tryGet() || + !timestampFunction.tryGet()) {{ + throw InvalidQuerySyntax("{sql_token} arguments must be field references"); + }} + + helpers.top().windowAggs.push_back( + {nebula_name}AggregationLogicalFunction::create(valueFunction.get(), + timestampFunction.get())); + helpers.top().functionBuilder.push_back(valueFunction); + }} + break; + /* END CODEGEN AGGREGATION GLUE: {sql_token} (case-switch) */ +""" + +# Site 2 — funcName == "TOKEN" string chain. +FUNCNAME_CHAIN_TGEO = """\ + /* BEGIN CODEGEN AGGREGATION GLUE: {sql_token} (funcName chain) */ + else if (funcName == "{sql_token}") + {{ + if (helpers.top().functionBuilder.size() < 3) + {{ + throw InvalidQuerySyntax("{sql_token} requires three arguments at {{}}", context->getText()); + }} + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lat = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto lon = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back({nebula_name}AggregationLogicalFunction::create(lon, lat, ts)); + }} + /* END CODEGEN AGGREGATION GLUE: {sql_token} (funcName chain) */ +""" + +FUNCNAME_CHAIN_TNUMBER = """\ + /* BEGIN CODEGEN AGGREGATION GLUE: {sql_token} (funcName chain) */ + else if (funcName == "{sql_token}") + {{ + if (helpers.top().functionBuilder.size() < 2) + {{ + throw InvalidQuerySyntax("{sql_token} requires two arguments at {{}}", context->getText()); + }} + const auto ts = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + const auto value = helpers.top().functionBuilder.back().get(); + helpers.top().functionBuilder.pop_back(); + helpers.top().windowAggs.push_back({nebula_name}AggregationLogicalFunction::create(value, ts)); + }} + /* END CODEGEN AGGREGATION GLUE: {sql_token} (funcName chain) */ +""" + +# Site 3 — optimizer logical→physical lowering rule. +OPTIMIZER_LOWERING_TGEO = """\ + /* BEGIN CODEGEN AGGREGATION GLUE: {class_name_token} (optimizer lowering) */ + if (name == std::string_view("{class_name_token}")) + {{ + auto specificDescriptor = std::dynamic_pointer_cast<{nebula_name}AggregationLogicalFunction>(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected {nebula_name}AggregationLogicalFunction for {class_name_token}"); + + auto lonPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLonField()); + auto latPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getLatField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("lon", specificDescriptor->getLonField().getDataType()); + stateSchema.addField("lat", specificDescriptor->getLatField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared<{nebula_name}AggregationPhysicalFunction>( + std::move(physicalInputType), + std::move(physicalFinalType), + lonPF, + latPF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + }} + /* END CODEGEN AGGREGATION GLUE: {class_name_token} (optimizer lowering) */ +""" + +OPTIMIZER_LOWERING_TNUMBER = """\ + /* BEGIN CODEGEN AGGREGATION GLUE: {class_name_token} (optimizer lowering) */ + if (name == std::string_view("{class_name_token}")) + {{ + auto specificDescriptor = std::dynamic_pointer_cast<{nebula_name}AggregationLogicalFunction>(descriptor); + INVARIANT(specificDescriptor != nullptr, "Expected {nebula_name}AggregationLogicalFunction for {class_name_token}"); + + auto valuePF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getValueField()); + auto tsPF = QueryCompilation::FunctionProvider::lowerFunction(specificDescriptor->getTimestampField()); + + Schema stateSchema; + stateSchema.addField("value", specificDescriptor->getValueField().getDataType()); + stateSchema.addField("timestamp", specificDescriptor->getTimestampField().getDataType()); + auto tupleBufferRef = Interface::BufferRef::TupleBufferRef::create(configuration.pageSize.getValue(), stateSchema); + + auto phys = std::make_shared<{nebula_name}AggregationPhysicalFunction>( + std::move(physicalInputType), + std::move(physicalFinalType), + valuePF, + tsPF, + resultFieldIdentifier, + tupleBufferRef); + aggregationPhysicalFunctions.push_back(std::move(phys)); + continue; + }} + /* END CODEGEN AGGREGATION GLUE: {class_name_token} (optimizer lowering) */ +""" + +# =========================================================================== +# Expandable-Temporal* VALUE-OUTPUT: f(live mini-trip) -> Temporal* result, +# serialized to hex-WKB as VARSIZED (the proven box-output VARSIZED tail). +# Derived from PHYSICAL_CPP_TGEO_EXPAND by swapping only the scalar lower() for +# the value-output one. Wires the Temporal-returning single-temporal transforms +# (tgeo_centroid, tpoint_azimuth, tgeompoint_to_tgeometry, …) as windowed +# aggregates over the expandable trajectory. +# =========================================================================== +_EXPAND_LOWER_SCALAR = """\ + auto resultValue = nautilus::invoke( + +[](AggregationState* st) -> {return_cpp_type} + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) {{ + return ({return_cpp_type})0; + }} + return {meos_scalar_fn}(*slot); + }}, + aggregationState); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, resultValue); + return resultRecord;""" + +_EXPAND_LOWER_WKB = """\ + auto hexStr = nautilus::invoke( + +[](AggregationState* st) -> char* + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Temporal** slot = reinterpret_cast(st); + if (*slot == nullptr) {{ + return (char*)nullptr; + }} + Temporal* res = {meos_scalar_fn}(*slot); + if (!res) {{ + return (char*)nullptr; + }} + size_t hexSize = 0; + char* hexOut = temporal_as_hexwkb(res, 0, &hexSize); + free(res); + return hexOut; + }}, + aggregationState); + + const auto hexLen = nautilus::invoke( + +[](const char* s) -> size_t {{ return s ? strlen(s) : (size_t) 0; }}, + hexStr); + + auto variableSized = pipelineMemoryProvider.arena.allocateVariableSizedData(hexLen); + + nautilus::invoke( + +[](int8_t* dest, const char* s, size_t len) -> void + {{ + if (s) {{ + memcpy(dest, s, len); + free((void*)s); + }} + }}, + variableSized.getContent(), + hexStr, + hexLen); + + Nautilus::Record resultRecord; + resultRecord.write(resultFieldIdentifier, variableSized); + return resultRecord;""" + +PHYSICAL_CPP_TGEO_EXPAND_WKB = _swap_once( + PHYSICAL_CPP_TGEO_EXPAND, _EXPAND_LOWER_SCALAR, _EXPAND_LOWER_WKB, + "expand scalar lower -> value-output (hex-WKB) lower") + +# geometry value-output: f(traj) returns a GSERIALIZED (start/end point, convex +# hull, time-weighted centroid of the windowed trajectory), serialized as +# canonical hex-EWKB via geo_out. Same Temporal* slot/lift/append; only the +# finalize differs from the temporal value-output (GSERIALIZED + geo_out, no +# hexSize out-param). +_EXPAND_LOWER_GEO_WKB = _swap_once( + _swap_once(_EXPAND_LOWER_WKB, + "Temporal* res = {meos_scalar_fn}(*slot);", + "GSERIALIZED* res = {meos_scalar_fn}(*slot);", + "value-output res type Temporal -> GSERIALIZED"), + "size_t hexSize = 0;\n char* hexOut = temporal_as_hexwkb(res, 0, &hexSize);", + "char* hexOut = geo_out(res);", + "temporal hex-WKB -> geometry hex-EWKB (geo_out)") + +PHYSICAL_CPP_TGEO_EXPAND_GEO_WKB = _swap_once( + PHYSICAL_CPP_TGEO_EXPAND, _EXPAND_LOWER_SCALAR, _EXPAND_LOWER_GEO_WKB, + "expand scalar lower -> geometry value-output (hex-EWKB) lower") + +# tnumber expandable value-output: same Temporal*-slot lower/reset/cleanup, but +# the per-event instant is a tfloat ("value@ts" via tfloat_in) and the ctor takes +# (value, ts). Derived from the tgeo expand-wkb template by swapping only the ctor +# and lift (the rest — Temporal* slot, appendInstant, value-output finalize — is +# input-shape-independent). +_EXPAND_CTOR_TGEO = """\ +{nebula_name}AggregationPhysicalFunction::{nebula_name}AggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction lonFunctionParam, + PhysicalFunction latFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), lonFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , lonFunction(std::move(lonFunctionParam)) + , latFunction(std::move(latFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{{ +}}""" +_EXPAND_CTOR_TNUMBER = """\ +{nebula_name}AggregationPhysicalFunction::{nebula_name}AggregationPhysicalFunction( + DataType inputType, + DataType resultType, + PhysicalFunction valueFunctionParam, + PhysicalFunction timestampFunctionParam, + Nautilus::Record::RecordFieldIdentifier resultFieldIdentifier, + std::shared_ptr bufferRef) + : AggregationPhysicalFunction(std::move(inputType), std::move(resultType), valueFunctionParam, std::move(resultFieldIdentifier)) + , bufferRef(std::move(bufferRef)) + , valueFunction(std::move(valueFunctionParam)) + , timestampFunction(std::move(timestampFunctionParam)) +{{ +}}""" +_EXPAND_LIFT_TGEO = """\ + auto lonValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto latValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto lon = lonValue.cast>(); + auto lat = latValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double lonVal, double latVal, int64_t tsVal) -> void + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[120]; + snprintf(wkt, sizeof(wkt), "SRID=4326;Point(%.6f %.6f)@%s", lonVal, latVal, ts.c_str()); + + // Public instant constructor: a single-instant tgeompoint Temporal. + Temporal* instTemp = tgeompoint_in(wkt); + if (!instTemp) {{ + return; + }} + if (*slot == nullptr) {{ + // First event: a 1-instant sequence; subsequent appendInstant calls + // grow it in place (expand=true doubles maxcount when full). + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + }} else {{ + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + }} + free(instTemp); // copied by tsequence_make / temporal_append_tinstant + }}, + aggregationState, + lon, + lat, + timestamp);""" +_EXPAND_LIFT_TNUMBER = """\ + auto valueValue = valueFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto value = valueValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, double valueVal, int64_t tsVal) -> void + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "%.6f@%s", valueVal, ts.c_str()); + + // Public instant constructor: a single-instant tfloat Temporal. + Temporal* instTemp = tfloat_in(wkt); + if (!instTemp) {{ + return; + }} + if (*slot == nullptr) {{ + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + }} else {{ + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + }} + free(instTemp); + }}, + aggregationState, + value, + timestamp);""" + +PHYSICAL_CPP_TNUMBER_EXPAND_WKB = _swap_once( + _swap_once(PHYSICAL_CPP_TGEO_EXPAND_WKB, _EXPAND_CTOR_TGEO, _EXPAND_CTOR_TNUMBER, "expand ctor tgeo->tnumber"), + _EXPAND_LIFT_TGEO, _EXPAND_LIFT_TNUMBER, "expand lift tgeo->tnumber") + +# tnpoint expandable value-output: reuses the 3-field tgeo HPP/parser/optimizer +# (the 3 args are rid, frac, ts); only the lift (NPoint instant via tnpoint_in) +# and the npoint include change. Wires tnpoint trajectory transforms over the +# windowed tnpoint mini-series. +_EXPAND_LIFT_TNPOINT = """\ + auto ridValue = lonFunction.execute(record, pipelineMemoryProvider.arena); + auto fracValue = latFunction.execute(record, pipelineMemoryProvider.arena); + auto timestampValue = timestampFunction.execute(record, pipelineMemoryProvider.arena); + + auto rid = ridValue.cast>(); + auto frac = fracValue.cast>(); + auto timestamp = timestampValue.cast>(); + + nautilus::invoke( + +[](AggregationState* st, int64_t ridVal, double fracVal, int64_t tsVal) -> void + {{ + MEOS::Meos::ensureMeosInitialized(); + std::lock_guard lock({mutex_name}); + Temporal** slot = reinterpret_cast(st); + + long long sec = (tsVal > 1000000000000LL) ? (tsVal / 1000) : tsVal; + std::string ts = MEOS::Meos::convertSecondsToTimestamp(sec); + char wkt[80]; + snprintf(wkt, sizeof(wkt), "NPoint(%lld,%.6f)@%s", (long long) ridVal, fracVal, ts.c_str()); + + Temporal* instTemp = tnpoint_in(wkt); + if (!instTemp) {{ + return; + }} + if (*slot == nullptr) {{ + TInstant* arr[1]; + arr[0] = (TInstant*) instTemp; + *slot = (Temporal*) tsequence_make((TInstant**) arr, 1, true, true, LINEAR, false); + }} else {{ + *slot = temporal_append_tinstant(*slot, (const TInstant*) instTemp, LINEAR, 0.0, nullptr, true); + }} + free(instTemp); + }}, + aggregationState, + rid, + frac, + timestamp);""" + +PHYSICAL_CPP_TNPOINT_EXPAND_WKB = _swap_once( + _swap_once(PHYSICAL_CPP_TGEO_EXPAND_WKB, _EXPAND_LIFT_TGEO, _EXPAND_LIFT_TNPOINT, "expand lift tgeo->tnpoint"), + "#include ", "#include \n#include ", "tnpoint include") + + +# =========================================================================== +# Shape dispatchers + emit_operator. +# =========================================================================== + +def physical_template_for(op): + box = op.get("return_mode") == "box" + if op["input_shape"] == "tgeo": + if op.get("return_mode") == "wkb": + return PHYSICAL_HPP_TGEO, PHYSICAL_CPP_TGEO_WKB + if op.get("return_mode") == "expand": + return PHYSICAL_HPP_TGEO, PHYSICAL_CPP_TGEO_EXPAND + if op.get("return_mode") == "expand_wkb": + return PHYSICAL_HPP_TGEO, PHYSICAL_CPP_TGEO_EXPAND_WKB + if op.get("return_mode") == "expand_geo_wkb": + return PHYSICAL_HPP_TGEO, PHYSICAL_CPP_TGEO_EXPAND_GEO_WKB + if op.get("return_mode") == "expand_wkb_tnpoint": + return PHYSICAL_HPP_TGEO, PHYSICAL_CPP_TNPOINT_EXPAND_WKB + return PHYSICAL_HPP_TGEO, (PHYSICAL_CPP_TGEO_BOX if box else PHYSICAL_CPP_TGEO) + if op["input_shape"] == "tnumber": + # Scalar-fold reuses the tnumber (value, ts) HPP but folds the field + # directly through the MEOS extent transition fn (no string / no parse); + # set-collect is the same shape with a Set state + a union finalfn. + if op.get("return_mode") == "expand_wkb": + return PHYSICAL_HPP_TNUMBER, PHYSICAL_CPP_TNUMBER_EXPAND_WKB + if op.get("fold") == "scalar": + return PHYSICAL_HPP_TNUMBER, PHYSICAL_CPP_SCALARFOLD + if op.get("fold") == "set": + return PHYSICAL_HPP_TNUMBER, PHYSICAL_CPP_SETFOLD + return PHYSICAL_HPP_TNUMBER, (PHYSICAL_CPP_TNUMBER_BOX if box else PHYSICAL_CPP_TNUMBER) + raise ValueError(f"unknown input_shape: {op['input_shape']}") + + +def logical_template_for(op): + if op["input_shape"] == "tgeo": + return LOGICAL_HPP_TGEO, LOGICAL_CPP_TGEO + if op["input_shape"] == "tnumber": + return LOGICAL_HPP_TNUMBER, LOGICAL_CPP_TNUMBER + raise ValueError(f"unknown input_shape: {op['input_shape']}") + + +def case_switch_template_for(op): + return CASE_SWITCH_TGEO if op["input_shape"] == "tgeo" else CASE_SWITCH_TNUMBER + + +def funcname_chain_template_for(op): + return FUNCNAME_CHAIN_TGEO if op["input_shape"] == "tgeo" else FUNCNAME_CHAIN_TNUMBER + + +def optimizer_lowering_template_for(op): + return OPTIMIZER_LOWERING_TGEO if op["input_shape"] == "tgeo" else OPTIMIZER_LOWERING_TNUMBER + + +def emit_operator(op, output_root: Path): + nebula_name = op["nebula_name"] + logical_hpp_tmpl, logical_cpp_tmpl = logical_template_for(op) + physical_hpp_tmpl, physical_cpp_tmpl = physical_template_for(op) + + # Common substitution dict. + fmt = { + "nebula_name": nebula_name, + "class_name_token": op["class_name_token"], + "sql_token": op["sql_token"], + "comment_one_liner": op["comment_one_liner"], + "meos_scalar_fn": op.get("meos_scalar_fn", ""), + "return_cpp_type": op.get("return_cpp_type", "double"), + "final_stamp_type": op["final_stamp_type"], + "mutex_name": f"meos_{nebula_name.lower()}_mutex", + # tnumber-only extras (harmless for tgeo since unused) + "lift_value_cpp_type": op.get("lift_value_cpp_type", "double"), + "value_printf_fmt": op.get("value_printf_fmt", "%.6f"), + "tnumber_in_fn": op.get("tnumber_in_fn", "tfloat_in"), + # box-output (VARSIZED extent) extras — only referenced by the *_BOX + # physical templates; harmless for scalar ops. + "extent_transfn": op.get("extent_transfn", ""), + "extent_box_type": op.get("extent_box_type", "STBox"), + "box_out_fn": op.get("box_out_fn", ""), + # scalar-fold / set-collect extras — referenced by the *FOLD templates. + "fold_field_cpp_type": op.get("fold_field_cpp_type", "double"), + "fold_invoke_body": op.get("fold_invoke_body", ""), + "box_out_call": op.get("box_out_call", ""), + "finalfn": op.get("finalfn", ""), + } + + # value_compute (point/tgeo finalize): either fold the windowed sequence + # directly with meos_scalar_fn, or — for the EXTENT shape — first reduce the + # sequence to its bounding box (tspatial_to_stbox / ...) and apply a box + # accessor/predicate to that windowed extent. In box-output mode the + # finalize is the serialized extent box itself (no value_compute). + box_build = op.get("extent_box_build_fn") + if op.get("return_mode") in ("box", "wkb"): + fmt["value_compute"] = "" + elif box_build: + box_t = op.get("extent_box_type", "STBox") + fmt["value_compute"] = ( + f'{box_t}* aggBox = {box_build}(static_cast(temp));\n' + f' {op["return_cpp_type"]} value = aggBox ? ' + f'{op["meos_scalar_fn"]}(aggBox) : ({op["return_cpp_type"]})0;\n' + f' if (aggBox) free(aggBox);') + else: + fmt["value_compute"] = ( + f'{op["return_cpp_type"]} value = ' + f'{op["meos_scalar_fn"]}(static_cast(temp));') + + paths = { + "logical_hpp": output_root / "nes-logical-operators/include/Operators/Windows/Aggregations/Meos" / f"{nebula_name}AggregationLogicalFunction.hpp", + "logical_cpp": output_root / "nes-logical-operators/src/Operators/Windows/Aggregations/Meos" / f"{nebula_name}AggregationLogicalFunction.cpp", + "physical_hpp": output_root / "nes-physical-operators/include/Aggregation/Function/Meos" / f"{nebula_name}AggregationPhysicalFunction.hpp", + "physical_cpp": output_root / "nes-physical-operators/src/Aggregation/Function/Meos" / f"{nebula_name}AggregationPhysicalFunction.cpp", + } + for p in paths.values(): + p.parent.mkdir(parents=True, exist_ok=True) + + paths["logical_hpp"].write_text(logical_hpp_tmpl.format(**fmt)) + paths["logical_cpp"].write_text(logical_cpp_tmpl.format(**fmt)) + paths["physical_hpp"].write_text(physical_hpp_tmpl.format(**fmt)) + paths["physical_cpp"].write_text(physical_cpp_tmpl.format(**fmt)) + sys.stderr.write(f" ✓ {nebula_name}: emitted 4 files\n") + + +# =========================================================================== +# Idempotent injectors. +# =========================================================================== + +def inject_cmake_entries(operators, output_root: Path) -> int: + """Append per-op `add_plugin(...)` entries to both layers' aggregation + CMakeLists. Idempotent: skips entries already present.""" + n_added = 0 + # Layer (logical | physical) → (CMakeLists path, plugin suffix) + layers = [ + ("logical", output_root / "nes-logical-operators/src/Operators/Windows/Aggregations/Meos/CMakeLists.txt", "Logical"), + ("physical", output_root / "nes-physical-operators/src/Aggregation/Function/Meos/CMakeLists.txt", "Physical"), + ] + for label, cml, suffix in layers: + if not cml.exists(): + sys.stderr.write(f" ! cmake-entries: {cml} not found, skipping {label}\n") + continue + body = cml.read_text() + new_lines = [] + for op in operators: + # Target name must NOT include "Aggregation" suffix — the registry codegen + # appends "Aggregation" itself, so a "...Aggregation" target + # would yield a double-Aggregation symbol. Mariana's convention is the + # target name = the SQL-side aggregation name (e.g. "TemporalLength"), + # NOT the C++ class basename. We follow that. + target_name = op["nebula_name"] + suffix_kind = "AggregationLogicalFunction" if label == "logical" else "AggregationPhysicalFunction" + registry_kind = "AggregationLogicalFunction" if label == "logical" else "AggregationPhysicalFunction" + cpp_basename = f"{op['nebula_name']}{suffix_kind}.cpp" + entry = ( + f"add_plugin({target_name} {registry_kind} " + f"nes-{label}-operators {cpp_basename})" + ) + # Match by basename to be tolerant of formatting drift + marker = f"add_plugin({target_name} {registry_kind}" + if marker in body: + continue + new_lines.append(entry) + if new_lines: + with cml.open("a") as f: + f.write("\n".join(new_lines) + "\n") + sys.stderr.write(f" ✓ cmake-entries ({label}): appended {len(new_lines)} entry(ies)\n") + n_added += len(new_lines) + return n_added + + +def inject_g4(operators, g4_path: Path) -> int: + """Inject lexer-token + functionName alternation entries into AntlrSQL.g4.""" + if not g4_path.exists(): + sys.stderr.write(f" ! g4: {g4_path} not found, skipping\n") + return 0 + body = g4_path.read_text() + n_added = 0 + + new_tokens = [] + for op in operators: + tok = op["sql_token"] + if re.search(rf"^{re.escape(tok)}\s*:", body, re.MULTILINE): + continue + new_tokens.append(f"{tok}: '{tok}' | '{tok.lower()}';") + if new_tokens: + if "/* BEGIN CODEGEN AGGREGATION LEXER TOKENS */" in body: + body = re.sub( + r"(/\* BEGIN CODEGEN AGGREGATION LEXER TOKENS \*/\n)(.*?)(/\* END CODEGEN AGGREGATION LEXER TOKENS \*/)", + lambda mm: mm.group(1) + mm.group(2) + "\n".join(new_tokens) + "\n" + mm.group(3), + body, count=1, flags=re.DOTALL, + ) + else: + anchor_re = re.compile(r"^WATERMARK:.*$", re.MULTILINE) + m = anchor_re.search(body) + if m is None: + sys.stderr.write(f" ! g4: WATERMARK anchor not found\n") + else: + insertion = ( + "/* BEGIN CODEGEN AGGREGATION LEXER TOKENS */\n" + + "\n".join(new_tokens) + + "\n/* END CODEGEN AGGREGATION LEXER TOKENS */\n" + ) + body = body[: m.start()] + insertion + body[m.start():] + n_added += len(new_tokens) + sys.stderr.write(f" ✓ g4 lexer-tokens: added {len(new_tokens)} token(s)\n") + + # functionName alternation + fn_re = re.compile(r"^functionName:\s*([^;]+);", re.MULTILINE) + m = fn_re.search(body) + if m is None: + sys.stderr.write(f" ! g4: functionName production not found\n") + else: + alternation = m.group(1) + new_alts = [] + for op in operators: + tok = op["sql_token"] + if re.search(rf"\b{re.escape(tok)}\b", alternation): + continue + new_alts.append(tok) + if new_alts: + new_alt_text = alternation.rstrip() + " | " + " | ".join(new_alts) + body = body[: m.start()] + f"functionName: {new_alt_text};" + body[m.end():] + sys.stderr.write(f" ✓ g4 functionName: added {len(new_alts)} alternative(s)\n") + + g4_path.write_text(body) + return n_added + + +def inject_parser_cpp(operators, cpp_path: Path) -> int: + """Inject TWO dispatch sites + per-op #include.""" + if not cpp_path.exists(): + sys.stderr.write(f" ! parser-cpp: {cpp_path} not found, skipping\n") + return 0 + body = cpp_path.read_text() + n_added = 0 + + # 1) #includes — insert after the LAST `#include ` line. + new_includes = [] + for op in operators: + inc = f"#include " + if inc in body: + continue + new_includes.append(inc) + if new_includes: + agg_inc_re = re.compile(r"(^#include ]+>\s*\n)+", re.MULTILINE) + matches = list(agg_inc_re.finditer(body)) + if matches: + last = matches[-1] + body = body[: last.end()] + "\n".join(new_includes) + "\n" + body[last.end():] + sys.stderr.write(f" ✓ parser-cpp aggregation includes: added {len(new_includes)}\n") + else: + # Fall back: insert after any Meos include + meos_inc_re = re.compile(r"(^#include ]+>\s*\n)+", re.MULTILINE) + matches = list(meos_inc_re.finditer(body)) + if matches: + last = matches[-1] + body = body[: last.end()] + "\n".join(new_includes) + "\n" + body[last.end():] + sys.stderr.write(f" ✓ parser-cpp aggregation includes (fallback): added {len(new_includes)}\n") + else: + sys.stderr.write(f" ! parser-cpp: no Meos include anchor found\n") + + # 2) Case-switch dispatch — insert after the last `END CODEGEN AGGREGATION GLUE: ... (case-switch)` + # marker, else before the `default:` of the switch that contains TGEO_AT_STBOX. + new_case_blocks = [] + for op in operators: + tmpl = case_switch_template_for(op) + marker = f"/* BEGIN CODEGEN AGGREGATION GLUE: {op['sql_token']} (case-switch) */" + if marker in body: + continue + # Skip if pre-existing hand-written case + if re.search(rf"case\s+AntlrSQLLexer::{re.escape(op['sql_token'])}\s*:", body): + sys.stderr.write( + f" ! parser-cpp: pre-existing case for {op['sql_token']} (case-switch); skipping\n" + ) + continue + new_case_blocks.append(tmpl.format( + sql_token=op["sql_token"], nebula_name=op["nebula_name"], comment_one_liner=op["comment_one_liner"], + )) + if new_case_blocks: + # Anchor preference order: + # 1. last `END CODEGEN AGGREGATION GLUE: ... (case-switch)` (own marker) + # 2. last `END CODEGEN PARSER GLUE: ...` (codegen_nebula.py W4.5+) + # 3. TGEO_AT_STBOX → default: (pre-W4.5 layout) + last_end_agg = list(re.finditer(r"/\* END CODEGEN AGGREGATION GLUE: [^*]+\(case-switch\)\s*\*/", body)) + last_end_nebula = list(re.finditer(r"/\* END CODEGEN PARSER GLUE: [^*]+\*/", body)) + if last_end_agg: + insert_at = last_end_agg[-1].end() + body = body[:insert_at] + "\n" + "\n".join(new_case_blocks) + body[insert_at:] + sys.stderr.write(f" ✓ parser-cpp case-switch: added {len(new_case_blocks)} (after own marker)\n") + elif last_end_nebula: + insert_at = last_end_nebula[-1].end() + body = body[:insert_at] + "\n" + "\n".join(new_case_blocks) + body[insert_at:] + sys.stderr.write(f" ✓ parser-cpp case-switch: added {len(new_case_blocks)} (after codegen_nebula marker)\n") + else: + anchor_re = re.compile(r"(case AntlrSQLLexer::TGEO_AT_STBOX:[\s\S]+?\n\s*break;\n)(\s*default:)") + m = anchor_re.search(body) + if m is None: + sys.stderr.write(f" ! parser-cpp: no case-switch anchor found\n") + else: + insertion = m.group(1) + "\n" + "\n".join(new_case_blocks) + "\n" + m.group(2) + body = body[: m.start()] + insertion + body[m.end():] + sys.stderr.write(f" ✓ parser-cpp case-switch: added {len(new_case_blocks)} (before default:)\n") + n_added += len(new_case_blocks) + + # 3) funcName-chain dispatch — insert after the last `END CODEGEN AGGREGATION GLUE: ... (funcName chain)`, + # else after mariana's CrossDistance else-if block. + new_chain_blocks = [] + for op in operators: + tmpl = funcname_chain_template_for(op) + marker = f"/* BEGIN CODEGEN AGGREGATION GLUE: {op['sql_token']} (funcName chain) */" + if marker in body: + continue + if re.search(rf'funcName == "{re.escape(op["sql_token"])}"', body): + sys.stderr.write( + f" ! parser-cpp: pre-existing funcName chain for {op['sql_token']}; skipping\n" + ) + continue + new_chain_blocks.append(tmpl.format(sql_token=op["sql_token"], nebula_name=op["nebula_name"])) + if new_chain_blocks: + last_end_re = re.compile(r"/\* END CODEGEN AGGREGATION GLUE: [^*]+\(funcName chain\)\s*\*/") + ends = list(last_end_re.finditer(body)) + if ends: + insert_at = ends[-1].end() + body = body[:insert_at] + "\n" + "\n".join(new_chain_blocks) + body[insert_at:] + sys.stderr.write(f" ✓ parser-cpp funcName chain: added {len(new_chain_blocks)} (after marker)\n") + else: + anchor_re = re.compile( + r'(else if \(funcName == "CROSS_DISTANCE"\)[\s\S]+?\n\s*\}\n)', + ) + m = anchor_re.search(body) + if m is None: + sys.stderr.write(f" ! parser-cpp: no funcName chain anchor (after CROSS_DISTANCE) found\n") + else: + insertion = m.group(1) + "\n".join(new_chain_blocks) + body = body[: m.end()] + "\n".join(new_chain_blocks) + body[m.end():] + sys.stderr.write(f" ✓ parser-cpp funcName chain: added {len(new_chain_blocks)} (after CROSS_DISTANCE)\n") + n_added += len(new_chain_blocks) + + cpp_path.write_text(body) + return n_added + + +def inject_optimizer(operators, opt_path: Path) -> int: + """Inject `if (name == "...")` blocks into LowerToPhysicalWindowedAggregation.cpp.""" + if not opt_path.exists(): + sys.stderr.write(f" ! optimizer: {opt_path} not found, skipping\n") + return 0 + body = opt_path.read_text() + n_added = 0 + + # 1) #include for the physical class header + new_includes = [] + for op in operators: + inc = f"#include " + if inc in body: + continue + new_includes.append(inc) + # Also need the logical class header + new_logical_includes = [] + for op in operators: + inc = f"#include " + if inc in body: + continue + new_logical_includes.append(inc) + if new_includes or new_logical_includes: + agg_inc_re = re.compile(r"(^#include ]+>\s*\n)+", re.MULTILINE) + matches = list(agg_inc_re.finditer(body)) + if matches: + last = matches[-1] + inserts = [] + if new_includes: + inserts.extend(new_includes) + if new_logical_includes: + inserts.extend(new_logical_includes) + body = body[: last.end()] + "\n".join(inserts) + "\n" + body[last.end():] + sys.stderr.write(f" ✓ optimizer includes: added {len(new_includes)} phys + {len(new_logical_includes)} logical\n") + else: + sys.stderr.write(f" ! optimizer: no Aggregation/Function/Meos include anchor found\n") + + # 2) The if-name-match block. Insert after last codegen END marker, else after mariana's CrossDistance block. + new_blocks = [] + for op in operators: + tmpl = optimizer_lowering_template_for(op) + marker = f"/* BEGIN CODEGEN AGGREGATION GLUE: {op['class_name_token']} (optimizer lowering) */" + if marker in body: + continue + # Skip if a pre-existing hand-written block exists for this class_name_token + if re.search(rf'name == std::string_view\("{re.escape(op["class_name_token"])}"\)', body): + sys.stderr.write( + f" ! optimizer: pre-existing lowering block for {op['class_name_token']}; skipping\n" + ) + continue + new_blocks.append(tmpl.format(class_name_token=op["class_name_token"], nebula_name=op["nebula_name"])) + if new_blocks: + last_end_re = re.compile(r"/\* END CODEGEN AGGREGATION GLUE: [^*]+\(optimizer lowering\)\s*\*/") + ends = list(last_end_re.finditer(body)) + if ends: + insert_at = ends[-1].end() + body = body[:insert_at] + "\n" + "\n".join(new_blocks) + body[insert_at:] + sys.stderr.write(f" ✓ optimizer lowering: added {len(new_blocks)} (after marker)\n") + else: + # Anchor: insert just before the "Default path: use registry" comment. + anchor_re = re.compile(r"(\n\s*// Default path: use registry)") + m = anchor_re.search(body) + if m is None: + sys.stderr.write(f" ! optimizer: 'Default path' anchor not found\n") + else: + insertion = "\n" + "\n".join(new_blocks) + m.group(1) + body = body[: m.start()] + insertion + body[m.end():] + sys.stderr.write(f" ✓ optimizer lowering: added {len(new_blocks)} (before Default path)\n") + n_added += len(new_blocks) + + opt_path.write_text(body) + return n_added + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--input", required=True) + parser.add_argument("--output-root", required=True) + parser.add_argument("--no-parser-glue", action="store_true") + parser.add_argument("--no-cmake-entries", action="store_true") + parser.add_argument("--no-optimizer-glue", action="store_true") + args = parser.parse_args() + + with open(args.input) as f: + config = json.load(f) + operators = config["operators"] + + # The serialized aggregation type (NAME), the optimizer-lowering match, and + # the registry key must be the same string for the query plan to round-trip + # (serialize set_type(NAME) -> worker create(type) -> registry key). The + # registry key is the add_plugin target = nebula_name (PascalCase), so + # class_name_token (which drives NAME + the optimizer match) MUST equal + # nebula_name. Earlier specs set it to the SQL token (UPPER_SNAKE), which + # made create(type) miss the registry and throw UnknownLogicalOperator at + # deserialize. The SQL spelling lives in sql_token (lexer/parser); it never + # belongs in NAME. Normalize here so a stray spec value cannot reintroduce + # the mismatch. + for op in operators: + op["class_name_token"] = op["nebula_name"] + + output_root = Path(args.output_root).resolve() + if not (output_root / "nes-logical-operators").exists(): + sys.exit(f"ERROR: {output_root} does not look like MobilityNebula root") + + sys.stderr.write(f"Emitting {len(operators)} aggregation operator(s):\n\n") + for op in operators: + emit_operator(op, output_root) + + if not args.no_cmake_entries: + sys.stderr.write("\nCMakeLists.txt:\n") + inject_cmake_entries(operators, output_root) + + if not args.no_parser_glue: + sys.stderr.write("\nParser glue:\n") + inject_g4(operators, output_root / "nes-sql-parser/AntlrSQL.g4") + inject_parser_cpp(operators, output_root / "nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp") + + if not args.no_optimizer_glue: + sys.stderr.write("\nOptimizer lowering glue:\n") + inject_optimizer(operators, output_root / "nes-query-optimizer/src/RewriteRules/LowerToPhysical/LowerToPhysicalWindowedAggregation.cpp") + + sys.stderr.write(f"\nDone. {len(operators) * 4} files emitted.\n") + + +if __name__ == "__main__": + main() diff --git a/tools/codegen/codegen_input.example.json b/tools/codegen/codegen_input.example.json new file mode 100644 index 0000000000..cbfd0ed15e --- /dev/null +++ b/tools/codegen/codegen_input.example.json @@ -0,0 +1,160 @@ +{ + "_comment": "Example input for codegen_nebula.py \u2014 first wave of MEOS spatial-relation E/A predicates. Each operator descriptor produces one logical .hpp/.cpp + one physical .hpp/.cpp file. Adjust the list to control which functions get generated.", + "operators": [ + { + "nebula_name": "TemporalEDisjointGeometry", + "sql_token": "TEMPORAL_EDISJOINT_GEOMETRY", + "meos_call": "edisjoint_tgeo_geo", + "args": [ + { + "name": "lon", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "lat", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "timestamp", + "nautilus_type": "uint64_t", + "cpp_type": "uint64_t" + }, + { + "name": "geometry", + "nautilus_type": "VariableSizedData", + "cpp_type": "const char*" + } + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_temporal_point": true, + "comment_one_liner": "Per-event ever-disjoint between a single-instant tgeompoint built from event fields and a static geometry." + }, + { + "nebula_name": "TemporalATouchesGeometry", + "sql_token": "TEMPORAL_ATOUCHES_GEOMETRY", + "meos_call": "atouches_tgeo_geo", + "args": [ + { + "name": "lon", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "lat", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "timestamp", + "nautilus_type": "uint64_t", + "cpp_type": "uint64_t" + }, + { + "name": "geometry", + "nautilus_type": "VariableSizedData", + "cpp_type": "const char*" + } + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_temporal_point": true, + "comment_one_liner": "Per-event always-touches between a single-instant tgeompoint and a static geometry." + }, + { + "nebula_name": "TemporalECoversGeometry", + "sql_token": "TEMPORAL_ECOVERS_GEOMETRY", + "meos_call": "ecovers_tgeo_geo", + "args": [ + { + "name": "lon", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "lat", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "timestamp", + "nautilus_type": "uint64_t", + "cpp_type": "uint64_t" + }, + { + "name": "geometry", + "nautilus_type": "VariableSizedData", + "cpp_type": "const char*" + } + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_temporal_point": true, + "comment_one_liner": "Per-event ever-covers between a single-instant tgeompoint and a static geometry." + }, + { + "nebula_name": "TemporalAContainsGeometry", + "sql_token": "TEMPORAL_ACONTAINS_GEOMETRY", + "meos_call": "acontains_tgeo_geo", + "args": [ + { + "name": "lon", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "lat", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "timestamp", + "nautilus_type": "uint64_t", + "cpp_type": "uint64_t" + }, + { + "name": "geometry", + "nautilus_type": "VariableSizedData", + "cpp_type": "const char*" + } + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_temporal_point": true, + "comment_one_liner": "Per-event always-contains between a single-instant tgeompoint and a static geometry." + }, + { + "nebula_name": "TemporalETouchesGeometry", + "sql_token": "TEMPORAL_ETOUCHES_GEOMETRY", + "meos_call": "etouches_tgeo_geo", + "args": [ + { + "name": "lon", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "lat", + "nautilus_type": "double", + "cpp_type": "double" + }, + { + "name": "timestamp", + "nautilus_type": "uint64_t", + "cpp_type": "uint64_t" + }, + { + "name": "geometry", + "nautilus_type": "VariableSizedData", + "cpp_type": "const char*" + } + ], + "return_type": "int", + "nautilus_return": "INT32", + "build_temporal_point": true, + "comment_one_liner": "Per-event ever-touches between a single-instant tgeompoint and a static geometry." + } + ] +} diff --git a/tools/codegen/codegen_nebula.py b/tools/codegen/codegen_nebula.py new file mode 100644 index 0000000000..9f8c0ab638 --- /dev/null +++ b/tools/codegen/codegen_nebula.py @@ -0,0 +1,3951 @@ +#!/usr/bin/env python3 +"""MobilityNebula MEOS-operator generator. + +Given a JSON descriptor list of MEOS scalar functions to wrap as +NebulaStream operators, emits the 4 pipeline-layer C++ files per +function (logical .hpp/.cpp + physical .hpp/.cpp) following the +established style of the existing hand-written operators (e.g. +TemporalEDWithinGeometryLogicalFunction), AND auto-injects: + +- per-op CMakeLists.txt entries in nes-{logical,physical}-operators/ + src/Functions/Meos/ +- AntlrSQL.g4 lexer-token + functionName-alternation entries +- AntlrSQLQueryPlanCreator.cpp #include + dispatch-case block + +Injection is idempotent — markers like +`/* BEGIN CODEGEN PARSER GLUE: */ … /* END CODEGEN PARSER GLUE */` +gate each per-op block, and the script skips on re-run when the marker +is already present. + +Usage: + python3 codegen_nebula.py --input codegen_input.example.json \\ + --output-root /path/to/MobilityNebula \\ + [--no-parser-glue] # skip .g4 + parser .cpp + [--no-cmake-entries] # skip CMakeLists.txt +""" +import argparse +import json +import re +import sys +from pathlib import Path + +# =========================================================================== +# Templates (mirror the hand-written TemporalEDWithinGeometry style 1:1). +# =========================================================================== + +LOGICAL_HPP_TEMPLATE = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES {{ + +/** + * @brief {comment_one_liner} + * + * Generated by tools/codegen/codegen_nebula.py from the MEOS function + * `{meos_call}`. Per-event scalar operator following the + * TemporalEDWithinGeometry pattern. + */ +class {nebula_name}LogicalFunction : public LogicalFunctionConcept {{ +public: + static constexpr std::string_view NAME = "{nebula_name}"; + + {nebula_name}LogicalFunction({ctor_logical_args}); + + DataType getDataType() const override; + LogicalFunction withDataType(const DataType& dataType) const override; + std::vector getChildren() const override; + LogicalFunction withChildren(const std::vector& children) const override; + std::string_view getType() const override; + bool operator==(const LogicalFunctionConcept& rhs) const override; + std::string explain(ExplainVerbosity verbosity) const override; + LogicalFunction withInferredDataType(const Schema& schema) const override; + SerializableFunction serialize() const override; + +private: + DataType dataType; + std::vector parameters; +}}; + +}} // namespace NES +""" + +LOGICAL_CPP_TEMPLATE = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NES +{{ + +{nebula_name}LogicalFunction::{nebula_name}LogicalFunction({ctor_logical_args}) + : dataType(DataTypeProvider::provideDataType(DataType::Type::{nautilus_return})) +{{ + parameters.reserve({n_args}); +{ctor_logical_pushes} +}} + +DataType {nebula_name}LogicalFunction::getDataType() const +{{ + return dataType; +}} + +LogicalFunction {nebula_name}LogicalFunction::withDataType(const DataType& newDataType) const +{{ + auto copy = *this; + copy.dataType = newDataType; + return copy; +}} + +std::vector {nebula_name}LogicalFunction::getChildren() const +{{ + return parameters; +}} + +LogicalFunction {nebula_name}LogicalFunction::withChildren(const std::vector& children) const +{{ + PRECONDITION(children.size() == {n_args}, "{nebula_name}LogicalFunction requires {n_args} children, but got {{}}", children.size()); + auto copy = *this; + copy.parameters = children; + return copy; +}} + +std::string_view {nebula_name}LogicalFunction::getType() const +{{ + return NAME; +}} + +bool {nebula_name}LogicalFunction::operator==(const LogicalFunctionConcept& rhs) const +{{ + if (const auto* other = dynamic_cast(&rhs)) + {{ + return parameters == other->parameters; + }} + return false; +}} + +std::string {nebula_name}LogicalFunction::explain(ExplainVerbosity verbosity) const +{{ + std::string args; + for (size_t index = 0; index < parameters.size(); ++index) + {{ + if (index > 0) + {{ + args += ", "; + }} + args += parameters[index].explain(verbosity); + }} + return fmt::format("{{}}({{}})", NAME, args); +}} + +LogicalFunction {nebula_name}LogicalFunction::withInferredDataType(const Schema& schema) const +{{ + std::vector newChildren; + newChildren.reserve(parameters.size()); + for (const auto& child : parameters) + {{ + newChildren.emplace_back(child.withInferredDataType(schema)); + }} + return withChildren(newChildren); +}} + +SerializableFunction {nebula_name}LogicalFunction::serialize() const +{{ + SerializableFunction proto; + proto.set_function_type(std::string(NAME)); + DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type()); + for (const auto& child : parameters) + {{ + proto.add_children()->CopyFrom(child.serialize()); + }} + return proto; +}} + +LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::Register{nebula_name}LogicalFunction( + LogicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.children.size() == {n_args}, + "{nebula_name}LogicalFunction requires {n_args} children but got {{}}", + arguments.children.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + +PHYSICAL_HPP_TEMPLATE = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include +#include +#include + +namespace NES {{ + +/** + * @brief Physical operator for `{meos_call}`. + * + * {comment_one_liner} + * + * Generated by tools/codegen/codegen_nebula.py. + */ +class {nebula_name}PhysicalFunction : public PhysicalFunctionConcept {{ +public: + {nebula_name}PhysicalFunction({ctor_physical_args}); + + VarVal execute(const Record& record, ArenaRef& arena) const override; + +private: + std::vector parameterFunctions; +}}; + +}} // namespace NES +""" + +# Physical .cpp template; the `body` placeholder is the MEOS-call body +# (the heart of the operator). For `build_temporal_point` operators +# we emit a per-event temporal-point build + MEOS call, mirroring +# TemporalEDWithinGeometry; for non-temporal-point operators (future +# templates) the body shape differs and a separate template branch +# would be added here. +PHYSICAL_CPP_TEMPLATE_TEMPORAL_POINT = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) {{ + return 0; + }} + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({{}} {{}})@{{}}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) + return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS spatial-relation call — same shape as TemporalEDWithin's + // edwithin_tgeo_geo, but specific MEOS function per generated operator. + // Real MEOS spatial-rel signature: int fn(const Temporal *, const GSERIALIZED *) + // (no `atstart` flag — that's specific to geog_dwithin / edwithin's 3-arg variant). + return {meos_call}(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + +# Physical .cpp template for two-temporal-points operators (e.g. *_tgeo_tgeo +# spatial-relations). Two single-instant tgeompoints are built from event +# fields (lonA/latA/tsA + lonB/latB/tsB) and passed to a MEOS function whose +# C signature is `int fn(const Temporal*, const Temporal*)`. Mirrors the +# one-temporal-point template above; the bodies differ only in arg shape +# and in the absence of a static-geometry argument. +PHYSICAL_CPP_TEMPLATE_TWO_TEMPORAL_POINTS = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({{}} {{}})@{{}}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({{}} {{}})@{{}}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo spatial-relation: int fn(const Temporal*, const Temporal*). + return {meos_call}(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry()); + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lonA, latA, tsA, lonB, latB, tsB); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for one-temporal-point operators with a trailing +# `double dist` argument (e.g. edwithin_tgeo_geo / adwithin_tgeo_geo). Same +# layout as PHYSICAL_CPP_TEMPLATE_TEMPORAL_POINT but the MEOS call passes +# `dist` as the 3rd argument. +PHYSICAL_CPP_TEMPLATE_TEMPORAL_POINT_WITH_DIST = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + auto dist = parameterValues[4].cast>(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize, + double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({{}} {{}})@{{}}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS *_tgeo_geo with trailing distance arg + // — int fn(const Temporal*, const GSERIALIZED*, double). + return {meos_call}(temporalGeometry.getGeometry(), + staticGeometry.getGeometry(), + distValue); + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + +# Physical .cpp template for two-temporal-points operators with a trailing +# `double dist` argument (edwithin_tgeo_tgeo / adwithin_tgeo_tgeo). +PHYSICAL_CPP_TEMPLATE_TWO_TEMPORAL_POINTS_WITH_DIST = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto lonB = parameterValues[3].cast>(); + auto latB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + auto dist = parameterValues[6].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, uint64_t tsAValue, + double lonBValue, double latBValue, uint64_t tsBValue, + double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string temporalGeometryAWkt = fmt::format("SRID=4326;Point({{}} {{}})@{{}}", lonAValue, latAValue, tsAString); + std::string temporalGeometryBWkt = fmt::format("SRID=4326;Point({{}} {{}})@{{}}", lonBValue, latBValue, tsBString); + + MEOS::Meos::TemporalGeometry temporalGeometryA(temporalGeometryAWkt); + if (!temporalGeometryA.getGeometry()) return 0; + MEOS::Meos::TemporalGeometry temporalGeometryB(temporalGeometryBWkt); + if (!temporalGeometryB.getGeometry()) return 0; + + // MEOS *_tgeo_tgeo with trailing distance arg + // — int fn(const Temporal*, const Temporal*, double). + return {meos_call}(temporalGeometryA.getGeometry(), + temporalGeometryB.getGeometry(), + distValue); + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lonA, latA, tsA, lonB, latB, tsB, dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +def cpp_logical_type(arg): + """C++ constructor-arg type for a LogicalFunction parameter.""" + return "LogicalFunction" + + +def cpp_physical_type(arg): + """C++ constructor-arg type for a PhysicalFunction parameter.""" + return "PhysicalFunction" + + +def build_ctor_args(args, type_fn): + return ",\n ".join( + f"{type_fn(a)} {a['name']}" for a in args + ) + + +def build_pushes_logical(args): + return "\n".join(f" parameters.push_back(std::move({a['name']}));" for a in args) + + +def build_pushes_physical(args): + return "\n".join( + f" parameterFunctions.push_back(std::move({a['name']}Function));" for a in args + ) + + +def build_registrar_pushes_logical(args, nebula_name): + pushes = [] + for i, _ in enumerate(args): + pushes.append(f" auto arg{i} = std::move(arguments.children[{i}]);") + pushes.append( + f" return {nebula_name}LogicalFunction(" + ", ".join(f"std::move(arg{i})" for i in range(len(args))) + ");" + ) + return "\n".join(pushes) + + +def build_registrar_pushes_physical(args, nebula_name): + pushes = [] + for i, _ in enumerate(args): + # PhysicalFunctionRegistryArguments uses `childFunctions`, not `children` + # (LogicalFunctionRegistryArguments uses `children` — see registry headers). + pushes.append(f" auto arg{i} = std::move(arguments.childFunctions[{i}]);") + pushes.append( + f" return {nebula_name}PhysicalFunction(" + ", ".join(f"std::move(arg{i})" for i in range(len(args))) + ");" + ) + return "\n".join(pushes) + + +def generic_fields(op): + """The ordered (name, cpp) event fields for a 'generic' operator: + the input type's fields followed by one per extra arg.""" + fields = list(GENERIC_INPUTS[op["input_type"]]["fields"]) + for i, ex in enumerate(op.get("extra_args", [])): + fields.append((f"arg{i}", ex["cpp"] if ex["kind"] == "scalar" else "VariableSizedData")) + return fields + + +def emit_operator(op, output_root: Path): + nebula_name = op["nebula_name"] + if op.get("build_generic"): + # Derive the canonical arg list + return metadata so the shared logical + # and physical-hpp templates match the assembled physical .cpp. + op["args"] = [{"name": n, "nautilus_type": c, "cpp_type": c} for n, c in generic_fields(op)] + rt, nr = GENERIC_RETURNS[op["return_kind"]][:2] + op.setdefault("return_type", rt) + op.setdefault("nautilus_return", nr) + n_args = len(op["args"]) + + # Logical .hpp constructor args (LogicalFunction type each) + ctor_logical_args = build_ctor_args(op["args"], cpp_logical_type) + # Physical .hpp / .cpp constructor args use 'XxxFunction' naming convention + physical_args = [{"name": a["name"] + "Function"} for a in op["args"]] + ctor_physical_args = ",\n ".join( + f"PhysicalFunction {a['name']}" for a in physical_args + ) + + ctor_logical_pushes = build_pushes_logical(op["args"]) + ctor_physical_pushes = build_pushes_physical(op["args"]) + registrar_l = build_registrar_pushes_logical(op["args"], nebula_name) + registrar_p = build_registrar_pushes_physical(op["args"], nebula_name) + + common = { + "nebula_name": nebula_name, + "comment_one_liner": op["comment_one_liner"], + "meos_call": op["meos_call"], + "n_args": n_args, + "nautilus_return": op["nautilus_return"], + "return_type": op["return_type"], + "ctor_logical_args": ctor_logical_args, + "ctor_physical_args": ctor_physical_args, + "ctor_logical_pushes": ctor_logical_pushes, + "ctor_physical_pushes": ctor_physical_pushes, + "registrar_pushes": registrar_l, + # tnumber-shape extras (only consumed by the two tnumber templates). + # tnumber_wkt_format is a fmt::format pattern that ends up in C++ as-is; + # Python single-pass .format() means we want raw `{}@{}` here (no doubling). + "tnumber_value_cpp_type": op.get("tnumber_value_cpp_type", "double"), + "scalar_cpp_type": op.get("scalar_cpp_type", "double"), + "tnumber_wkt_format": op.get("tnumber_wkt_format", "{}@{}"), + "tnumber_in_fn": op.get("tnumber_in_fn", "tfloat_in"), + } + + logical_hpp_path = output_root / "nes-logical-operators/include/Functions/Meos" / f"{nebula_name}LogicalFunction.hpp" + logical_cpp_path = output_root / "nes-logical-operators/src/Functions/Meos" / f"{nebula_name}LogicalFunction.cpp" + physical_hpp_path = output_root / "nes-physical-operators/include/Functions/Meos" / f"{nebula_name}PhysicalFunction.hpp" + physical_cpp_path = output_root / "nes-physical-operators/src/Functions/Meos" / f"{nebula_name}PhysicalFunction.cpp" + + for p in (logical_hpp_path, logical_cpp_path, physical_hpp_path, physical_cpp_path): + p.parent.mkdir(parents=True, exist_ok=True) + + logical_hpp_path.write_text(LOGICAL_HPP_TEMPLATE.format(**common)) + logical_cpp_path.write_text(LOGICAL_CPP_TEMPLATE.format(**common)) + physical_hpp_path.write_text(PHYSICAL_HPP_TEMPLATE.format(**common)) + + physical_common = dict(common) + physical_common["registrar_pushes"] = registrar_p + if op.get("build_generic"): + physical_cpp_path.write_text(assemble_generic_physical(op)) + elif op.get("build_two_temporal_points_with_dist"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TEMPORAL_POINTS_WITH_DIST.format(**physical_common)) + elif op.get("build_temporal_point_with_dist"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TEMPORAL_POINT_WITH_DIST.format(**physical_common)) + elif op.get("build_two_temporal_points"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TEMPORAL_POINTS.format(**physical_common)) + elif op.get("build_temporal_point_restriction"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TEMPORAL_POINT_RESTRICTION.format(**physical_common)) + elif op.get("build_two_tpose_points_via_composition"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TPOSE_POINTS_VIA_COMPOSITION.format(**physical_common)) + elif op.get("build_tpose_point_via_composition"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TPOSE_POINT_VIA_COMPOSITION.format(**physical_common)) + elif op.get("build_two_tnpoint_points_via_composition"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TNPOINT_POINTS_VIA_COMPOSITION.format(**physical_common)) + elif op.get("build_tnpoint_point_via_composition"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TNPOINT_POINT_VIA_COMPOSITION.format(**physical_common)) + elif op.get("build_two_tpose_points_with_dist_via_composition"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TPOSE_POINTS_WITH_DIST_VIA_COMPOSITION.format(**physical_common)) + elif op.get("build_tpose_point_with_dist_via_composition"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TPOSE_POINT_WITH_DIST_VIA_COMPOSITION.format(**physical_common)) + elif op.get("build_two_tnpoint_points_with_dist_via_composition"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TNPOINT_POINTS_WITH_DIST_VIA_COMPOSITION.format(**physical_common)) + elif op.get("build_tnpoint_point_with_dist_via_composition"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TNPOINT_POINT_WITH_DIST_VIA_COMPOSITION.format(**physical_common)) + elif op.get("build_two_tcbuffer_points_with_dist"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TCBUFFER_POINTS_WITH_DIST.format(**physical_common)) + elif op.get("build_tcbuffer_point_cbuffer_with_dist"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT_CBUFFER_WITH_DIST.format(**physical_common)) + elif op.get("build_tcbuffer_point_with_dist"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT_WITH_DIST.format(**physical_common)) + elif op.get("build_two_tcbuffer_points"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TCBUFFER_POINTS.format(**physical_common)) + elif op.get("build_tcbuffer_point_cbuffer"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT_CBUFFER.format(**physical_common)) + elif op.get("build_tcbuffer_point"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT.format(**physical_common)) + elif op.get("build_temporal_point"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TEMPORAL_POINT.format(**physical_common)) + elif op.get("build_tnumber_point_with_scalar"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TNUMBER_POINT_WITH_SCALAR.format(**physical_common)) + elif op.get("build_tnumber_scalar_first"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TNUMBER_SCALAR_FIRST.format(**physical_common)) + elif op.get("build_two_tnumber_points"): + physical_cpp_path.write_text(PHYSICAL_CPP_TEMPLATE_TWO_TNUMBER_POINTS.format(**physical_common)) + else: + sys.stderr.write( + f" ! {nebula_name}: physical-cpp template for non-temporal-point ops is not yet implemented; " + f"skipping .cpp — the .hpp + logical files are still emitted, but the .cpp must be hand-written.\n" + ) + + sys.stderr.write(f" ✓ {nebula_name}: emitted 4 files ({logical_hpp_path.relative_to(output_root)} + siblings)\n") + + +# Physical .cpp template for one-temporal-point restriction operators — +# MEOS signature `Temporal* fn(const Temporal*, const GSERIALIZED*)`. The +# returned Temporal* is checked for non-null (i.e. survived the restriction), +# freed, and reduced to an int (1 = survives, 0 = clipped/null/error). +# Per-event single-instant semantics: equivalent to a filter predicate. +# Mirrors mariana's TemporalAtStBox int-collapse pattern. +PHYSICAL_CPP_TEMPLATE_TEMPORAL_POINT_RESTRICTION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string temporalGeometryWkt = fmt::format("SRID=4326;Point({{}} {{}})@{{}}", lonValue, latValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (temporalGeometryWkt.empty() || staticGeometryWkt.empty()) return 0; + + MEOS::Meos::TemporalGeometry temporalGeometry(temporalGeometryWkt); + if (!temporalGeometry.getGeometry()) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) return 0; + + // MEOS restriction call — returns Temporal* (non-null if the + // input survived the restriction, null if clipped/empty). + // For per-event single-instant inputs this collapses to a + // filter predicate: 1 if the point survives, 0 if clipped. + Temporal* clipped = {meos_call}(temporalGeometry.getGeometry(), + staticGeometry.getGeometry()); + if (clipped == nullptr) return 0; + free(clipped); + return 1; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lon, lat, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for one-tcbuffer-point operators with a static +# geometry — e.g. econtains_tcbuffer_geo. The MEOS call signature is +# ` fn(const Temporal*, const GSERIALIZED*)` where the Temporal is a +# tcbuffer (Cbuffer instant) built per-event from (lon, lat, radius, ts). +# WKT format: "Cbuffer(Point(lon lat),radius)@ts". +# 5 SQL args: lon, lat, radius, ts, geometry. +PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* geometryPtr, + uint32_t geometrySize) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) {{ free(tcbuffer); return 0; }} + + {return_type} r = {meos_call}(tcbuffer, staticGeometry.getGeometry()); + free(tcbuffer); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for tpose × static geom spatial-rels VIA +# COMPOSITION — the existing _tgeo_geo MEOS call is applied to a tpose +# converted to tgeompoint at run time. Per-event tpose instant from +# (x, y, theta, ts), then tpose_to_tpoint(), then the MEOS spatial-rel +# call. Matches MobilityDB PR #987's SQL-level composition recipe at the +# binding layer (no new MEOS spatial-rel symbols are needed for tpose). +# 5 SQL args: x, y, theta, ts, geometry. +PHYSICAL_CPP_TEMPLATE_TPOSE_POINT_VIA_COMPOSITION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({{}} {{}}), {{}})@{{}}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) {{ free(tpose); return 0; }} + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) {{ free(tgeo); free(tpose); return 0; }} + + {return_type} r = {meos_call}(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tpose); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for tpose × tpose spatial-rels VIA COMPOSITION — +# the existing _tgeo_tgeo MEOS call is applied to two tposes each converted +# to a single-instant tgeompoint at run time. Per-event tpose instants from +# (xA, yA, thetaA, tsA) and (xB, yB, thetaB, tsB), each tpose_in() then +# tpose_to_tpoint(), then the MEOS two-temporal spatial-rel call. Mirrors the +# W14 one-tpose composition recipe; no new MEOS symbols are needed for tpose +# (the _tgeo_tgeo row was shipped in W3). 8 SQL args. +PHYSICAL_CPP_TEMPLATE_TWO_TPOSE_POINTS_VIA_COMPOSITION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({{}} {{}}), {{}})@{{}}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({{}} {{}}), {{}})@{{}}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) {{ free(tposeA); return 0; }} + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) {{ free(tgeoA); free(tposeA); return 0; }} + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) {{ free(tposeB); free(tgeoA); free(tposeA); return 0; }} + + {return_type} r = {meos_call}(tgeoA, tgeoB); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for tnpoint × static geom spatial-rels VIA +# COMPOSITION — a temporal network point is resolved to a temporal +# geometry point at run time (tnpoint_to_tgeompoint, which looks up each +# route's geometry from the MEOS ways network), then the existing +# _tgeo_geo spatial-rel is applied. Same shape as the tpose composition +# (W14); no new MEOS spatial-rel symbols are needed for tnpoint. +# NOTE: tnpoint_to_tgeompoint yields a tgeompoint in the *network* SRID, +# so the static geometry must use that SRID (else MEOS errors on mixed +# SRID). 4 SQL args: rid, fraction, ts, geometry. +PHYSICAL_CPP_TEMPLATE_TNPOINT_POINT_VIA_COMPOSITION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({{}}, {{}})@{{}}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) {{ free(tnpoint); return 0; }} + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) {{ free(tgeo); free(tnpoint); return 0; }} + + {return_type} r = {meos_call}(tgeo, staticGeometry.getGeometry()); + free(tgeo); + free(tnpoint); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize()); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for tnpoint × tnpoint spatial-rels VIA +# COMPOSITION — two temporal network points each resolved to a temporal +# geometry point (tnpoint_to_tgeompoint), then the existing _tgeo_tgeo +# spatial-rel (W3) is applied. Both operands land in the network SRID, so +# no mixed-SRID concern (unlike tnpoint × static geom). 6 SQL args: +# ridA, fracA, tsA, ridB, fracB, tsB. +PHYSICAL_CPP_TEMPLATE_TWO_TNPOINT_POINTS_VIA_COMPOSITION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({{}}, {{}})@{{}}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({{}}, {{}})@{{}}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) {{ free(tnpointA); return 0; }} + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) {{ free(tgeoA); free(tnpointA); return 0; }} + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) {{ free(tnpointB); free(tgeoA); free(tnpointA); return 0; }} + + {return_type} r = {meos_call}(tgeoA, tgeoB); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + ridA, fractionA, tsA, ridB, fractionB, tsB); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for tpose × static geom dwithin VIA COMPOSITION — +# the tpose composition body (W14) plus a trailing `double dist` forwarded +# to the 3-arg `_tgeo_geo` dwithin call. 6 SQL args: x, y, theta, ts, +# geometry, dist. +PHYSICAL_CPP_TEMPLATE_TPOSE_POINT_WITH_DIST_VIA_COMPOSITION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto x = parameterValues[0].cast>(); + auto y = parameterValues[1].cast>(); + auto theta = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double xValue, double yValue, double thetaValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(xValue >= -180.0 && xValue <= 180.0 && yValue >= -90.0 && yValue <= 90.0)) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tposeWkt = fmt::format("Pose(Point({{}} {{}}), {{}})@{{}}", + xValue, yValue, thetaValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tposeWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tpose = tpose_in(tposeWkt.c_str()); + if (!tpose) return 0; + Temporal* tgeo = tpose_to_tpoint(tpose); + if (!tgeo) {{ free(tpose); return 0; }} + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) {{ free(tgeo); free(tpose); return 0; }} + + {return_type} r = {meos_call}(tgeo, staticGeometry.getGeometry(), distValue); + free(tgeo); + free(tpose); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + x, y, theta, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for tpose × tpose dwithin VIA COMPOSITION — the +# two-tpose composition body (W15) plus a trailing `double dist` forwarded +# to the 3-arg `_tgeo_tgeo` dwithin call. 9 SQL args. +PHYSICAL_CPP_TEMPLATE_TWO_TPOSE_POINTS_WITH_DIST_VIA_COMPOSITION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto xA = parameterValues[0].cast>(); + auto yA = parameterValues[1].cast>(); + auto thetaA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto xB = parameterValues[4].cast>(); + auto yB = parameterValues[5].cast>(); + auto thetaB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + auto dist = parameterValues[8].cast>(); + + const auto result = nautilus::invoke( + +[](double xAValue, double yAValue, double thetaAValue, uint64_t tsAValue, + double xBValue, double yBValue, double thetaBValue, uint64_t tsBValue, + double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(xAValue >= -180.0 && xAValue <= 180.0 && yAValue >= -90.0 && yAValue <= 90.0)) return 0; + if (!(xBValue >= -180.0 && xBValue <= 180.0 && yBValue >= -90.0 && yBValue <= 90.0)) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tposeAWkt = fmt::format("Pose(Point({{}} {{}}), {{}})@{{}}", xAValue, yAValue, thetaAValue, tsAString); + std::string tposeBWkt = fmt::format("Pose(Point({{}} {{}}), {{}})@{{}}", xBValue, yBValue, thetaBValue, tsBString); + + if (tposeAWkt.empty() || tposeBWkt.empty()) return 0; + + Temporal* tposeA = tpose_in(tposeAWkt.c_str()); + if (!tposeA) return 0; + Temporal* tgeoA = tpose_to_tpoint(tposeA); + if (!tgeoA) {{ free(tposeA); return 0; }} + Temporal* tposeB = tpose_in(tposeBWkt.c_str()); + if (!tposeB) {{ free(tgeoA); free(tposeA); return 0; }} + Temporal* tgeoB = tpose_to_tpoint(tposeB); + if (!tgeoB) {{ free(tposeB); free(tgeoA); free(tposeA); return 0; }} + + {return_type} r = {meos_call}(tgeoA, tgeoB, distValue); + free(tgeoB); + free(tposeB); + free(tgeoA); + free(tposeA); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + xA, yA, thetaA, tsA, xB, yB, thetaB, tsB, dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for tnpoint × static geom dwithin VIA COMPOSITION — +# tnpoint composition body (W18) plus a trailing `double dist` forwarded to +# the 3-arg `_tgeo_geo` dwithin call. 5 SQL args: rid, fraction, ts, +# geometry, dist. +PHYSICAL_CPP_TEMPLATE_TNPOINT_POINT_WITH_DIST_VIA_COMPOSITION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto rid = parameterValues[0].cast>(); + auto fraction = parameterValues[1].cast>(); + auto timestamp = parameterValues[2].cast>(); + auto geometry = parameterValues[3].cast(); + auto dist = parameterValues[4].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridValue, double fractionValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tnpointWkt = fmt::format("NPoint({{}}, {{}})@{{}}", ridValue, fractionValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tnpointWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tnpoint = tnpoint_in(tnpointWkt.c_str()); + if (!tnpoint) return 0; + Temporal* tgeo = tnpoint_to_tgeompoint(tnpoint); + if (!tgeo) {{ free(tnpoint); return 0; }} + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) {{ free(tgeo); free(tnpoint); return 0; }} + + {return_type} r = {meos_call}(tgeo, staticGeometry.getGeometry(), distValue); + free(tgeo); + free(tnpoint); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + rid, fraction, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for tnpoint × tnpoint dwithin VIA COMPOSITION — the +# two-tnpoint composition body (W18) plus a trailing `double dist` forwarded +# to the 3-arg `_tgeo_tgeo` dwithin call. 7 SQL args. +PHYSICAL_CPP_TEMPLATE_TWO_TNPOINT_POINTS_WITH_DIST_VIA_COMPOSITION = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto ridA = parameterValues[0].cast>(); + auto fractionA = parameterValues[1].cast>(); + auto tsA = parameterValues[2].cast>(); + auto ridB = parameterValues[3].cast>(); + auto fractionB = parameterValues[4].cast>(); + auto tsB = parameterValues[5].cast>(); + auto dist = parameterValues[6].cast>(); + + const auto result = nautilus::invoke( + +[](uint64_t ridAValue, double fractionAValue, uint64_t tsAValue, + uint64_t ridBValue, double fractionBValue, uint64_t tsBValue, + double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string tnpointAWkt = fmt::format("NPoint({{}}, {{}})@{{}}", ridAValue, fractionAValue, tsAString); + std::string tnpointBWkt = fmt::format("NPoint({{}}, {{}})@{{}}", ridBValue, fractionBValue, tsBString); + + if (tnpointAWkt.empty() || tnpointBWkt.empty()) return 0; + + Temporal* tnpointA = tnpoint_in(tnpointAWkt.c_str()); + if (!tnpointA) return 0; + Temporal* tgeoA = tnpoint_to_tgeompoint(tnpointA); + if (!tgeoA) {{ free(tnpointA); return 0; }} + Temporal* tnpointB = tnpoint_in(tnpointBWkt.c_str()); + if (!tnpointB) {{ free(tgeoA); free(tnpointA); return 0; }} + Temporal* tgeoB = tnpoint_to_tgeompoint(tnpointB); + if (!tgeoB) {{ free(tnpointB); free(tgeoA); free(tnpointA); return 0; }} + + {return_type} r = {meos_call}(tgeoA, tgeoB, distValue); + free(tgeoB); + free(tnpointB); + free(tgeoA); + free(tnpointA); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + ridA, fractionA, tsA, ridB, fractionB, tsB, dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for one-tcbuffer-point + static geom + dist — +# e.g. edwithin_tcbuffer_geo. Same per-event tcbuffer construction as +# PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT but trailing `double dist`. +# 6 SQL args: lon, lat, radius, ts, geometry, dist. +PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT_WITH_DIST = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto geometry = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonValue, double latValue, double radiusValue, uint64_t timestampValue, + const char* geometryPtr, uint32_t geometrySize, double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", + lonValue, latValue, radiusValue, timestampString); + std::string staticGeometryWkt(geometryPtr, geometrySize); + + while (!staticGeometryWkt.empty() && (staticGeometryWkt.front() == '\\'' || staticGeometryWkt.front() == '"')) + staticGeometryWkt.erase(staticGeometryWkt.begin()); + while (!staticGeometryWkt.empty() && (staticGeometryWkt.back() == '\\'' || staticGeometryWkt.back() == '"')) + staticGeometryWkt.pop_back(); + + if (tcbufferWkt.empty() || staticGeometryWkt.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + MEOS::Meos::StaticGeometry staticGeometry(staticGeometryWkt); + if (!staticGeometry.getGeometry()) {{ free(tcbuffer); return 0; }} + + {return_type} r = {meos_call}(tcbuffer, staticGeometry.getGeometry(), distValue); + free(tcbuffer); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lon, lat, radius, timestamp, geometry.getContent(), geometry.getContentSize(), dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + +# Physical .cpp template for one-tcbuffer-point + static Cbuffer + dist — +# e.g. edwithin_tcbuffer_cbuffer. +# 6 SQL args: lon, lat, radius, ts, cbufferLiteral, dist. +PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT_CBUFFER_WITH_DIST = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + auto dist = parameterValues[5].cast>(); + + const auto result = nautilus::invoke( + +[](double lonValue, double latValue, double radiusValue, uint64_t timestampValue, + const char* cbufLitPtr, uint32_t cbufLitSize, double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) {{ free(tcbuffer); return 0; }} + + {return_type} r = {meos_call}(tcbuffer, cb, distValue); + free(tcbuffer); + free(cb); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize(), dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + +# Physical .cpp template for two-tcbuffer-points + dist — e.g. +# edwithin_tcbuffer_tcbuffer. 9 SQL args: lonA, latA, radiusA, tsA, +# lonB, latB, radiusB, tsB, dist. +PHYSICAL_CPP_TEMPLATE_TWO_TCBUFFER_POINTS_WITH_DIST = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + auto dist = parameterValues[8].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue, + double distValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) {{ free(tA); return 0; }} + + {return_type} r = {meos_call}(tA, tB, distValue); + free(tA); + free(tB); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for TWO tcbuffer points (no static arg) — e.g. +# eintersects_tcbuffer_tcbuffer. Two per-event tcbuffer instants built +# from (lonA, latA, radiusA, tsA) and (lonB, latB, radiusB, tsB). +# MEOS signature: `int fn(const Temporal*, const Temporal*)`. +# 8 SQL args. +PHYSICAL_CPP_TEMPLATE_TWO_TCBUFFER_POINTS = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lonA = parameterValues[0].cast>(); + auto latA = parameterValues[1].cast>(); + auto radiusA = parameterValues[2].cast>(); + auto tsA = parameterValues[3].cast>(); + auto lonB = parameterValues[4].cast>(); + auto latB = parameterValues[5].cast>(); + auto radiusB = parameterValues[6].cast>(); + auto tsB = parameterValues[7].cast>(); + + const auto result = nautilus::invoke( + +[](double lonAValue, double latAValue, double radiusAValue, uint64_t tsAValue, + double lonBValue, double latBValue, double radiusBValue, uint64_t tsBValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonAValue >= -180.0 && lonAValue <= 180.0 && latAValue >= -90.0 && latAValue <= 90.0)) return 0; + if (!(lonBValue >= -180.0 && lonBValue <= 180.0 && latBValue >= -90.0 && latBValue <= 90.0)) return 0; + if (radiusAValue < 0.0 || radiusBValue < 0.0) return 0; + + const std::string tsAString = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBString = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", lonAValue, latAValue, radiusAValue, tsAString); + std::string wktB = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", lonBValue, latBValue, radiusBValue, tsBString); + + Temporal* tA = tcbuffer_in(wktA.c_str()); + if (!tA) return 0; + Temporal* tB = tcbuffer_in(wktB.c_str()); + if (!tB) {{ free(tA); return 0; }} + + {return_type} r = {meos_call}(tA, tB); + free(tA); + free(tB); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for one-tcbuffer-point operators with a STATIC +# CBUFFER second arg — e.g. econtains_tcbuffer_cbuffer. Same per-event +# tcbuffer construction as PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT; the +# second arg is parsed via cbuffer_in() from a literal WKT +# "Cbuffer(Point(lon lat),radius)" instead of as a GSERIALIZED geometry. +# MEOS signature: `int fn(const Temporal*, const Cbuffer*)`. +# 5 SQL args: lon, lat, radius, ts, cbufferLiteral. +PHYSICAL_CPP_TEMPLATE_TCBUFFER_POINT_CBUFFER = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto lon = parameterValues[0].cast>(); + auto lat = parameterValues[1].cast>(); + auto radius = parameterValues[2].cast>(); + auto timestamp = parameterValues[3].cast>(); + auto cbufLit = parameterValues[4].cast(); + + const auto result = nautilus::invoke( + +[](double lonValue, + double latValue, + double radiusValue, + uint64_t timestampValue, + const char* cbufLitPtr, + uint32_t cbufLitSize) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + if (!(lonValue >= -180.0 && lonValue <= 180.0 && latValue >= -90.0 && latValue <= 90.0)) return 0; + if (radiusValue < 0.0) return 0; + + const std::string timestampString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string tcbufferWkt = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", + lonValue, latValue, radiusValue, timestampString); + std::string cbufferLiteral(cbufLitPtr, cbufLitSize); + + while (!cbufferLiteral.empty() && (cbufferLiteral.front() == '\\'' || cbufferLiteral.front() == '"')) + cbufferLiteral.erase(cbufferLiteral.begin()); + while (!cbufferLiteral.empty() && (cbufferLiteral.back() == '\\'' || cbufferLiteral.back() == '"')) + cbufferLiteral.pop_back(); + + if (tcbufferWkt.empty() || cbufferLiteral.empty()) return 0; + + Temporal* tcbuffer = tcbuffer_in(tcbufferWkt.c_str()); + if (!tcbuffer) return 0; + Cbuffer* cb = cbuffer_in(cbufferLiteral.c_str()); + if (!cb) {{ free(tcbuffer); return 0; }} + + {return_type} r = {meos_call}(tcbuffer, cb); + free(tcbuffer); + free(cb); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + lon, lat, radius, timestamp, cbufLit.getContent(), cbufLit.getContentSize()); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp template for one-tnumber-point operators with a trailing +# scalar (double or int) — e.g. nad_tfloat_float, nad_tint_int. The MEOS +# call signature is ` fn(const Temporal*, )`. +# 3 args: value, timestamp, scalar. +PHYSICAL_CPP_TEMPLATE_TNUMBER_POINT_WITH_SCALAR = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[]({tnumber_value_cpp_type} valueValue, + uint64_t timestampValue, + {scalar_cpp_type} scalarValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{tnumber_wkt_format}", valueValue, tsString); + Temporal* temp = {tnumber_in_fn}(wkt.c_str()); + if (!temp) return 0; + {return_type} r = {meos_call}(temp, scalarValue); + free(temp); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + value, timestamp, scalar); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + +# Physical .cpp template for two-tnumber-point operators (e.g. nad_tfloat_tfloat, +# nad_tint_tint). MEOS signature ` fn(const Temporal*, const Temporal*)`. +# 4 args: valueA, tsA, valueB, tsB. +PHYSICAL_CPP_TEMPLATE_TWO_TNUMBER_POINTS = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto valueA = parameterValues[0].cast>(); + auto tsA = parameterValues[1].cast>(); + auto valueB = parameterValues[2].cast>(); + auto tsB = parameterValues[3].cast>(); + + const auto result = nautilus::invoke( + +[]({tnumber_value_cpp_type} valueAValue, uint64_t tsAValue, + {tnumber_value_cpp_type} valueBValue, uint64_t tsBValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + const std::string tsAStr = MEOS::Meos::convertEpochToTimestamp(tsAValue); + const std::string tsBStr = MEOS::Meos::convertEpochToTimestamp(tsBValue); + std::string wktA = fmt::format("{tnumber_wkt_format}", valueAValue, tsAStr); + std::string wktB = fmt::format("{tnumber_wkt_format}", valueBValue, tsBStr); + Temporal* tempA = {tnumber_in_fn}(wktA.c_str()); + if (!tempA) return 0; + Temporal* tempB = {tnumber_in_fn}(wktB.c_str()); + if (!tempB) {{ free(tempA); return 0; }} + {return_type} r = {meos_call}(tempA, tempB); + free(tempA); + free(tempB); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + valueA, tsA, valueB, tsB); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# Physical .cpp for scalar-FIRST tnumber operators — the MEOS signature is +# ` fn(scalar, const Temporal*)` (e.g. ever_eq_float_tfloat, +# always_lt_int_tint). Identical to TNUMBER_POINT_WITH_SCALAR except the MEOS +# call passes the scalar as the FIRST argument. Per-event SQL shape is still +# (value, timestamp, scalar) so it reuses DISPATCH_CASE_TNUMBER_POINT_WITH_SCALAR. +PHYSICAL_CPP_TEMPLATE_TNUMBER_SCALAR_FIRST = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +#include +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + + auto value = parameterValues[0].cast>(); + auto timestamp = parameterValues[1].cast>(); + auto scalar = parameterValues[2].cast>(); + + const auto result = nautilus::invoke( + +[]({tnumber_value_cpp_type} valueValue, + uint64_t timestampValue, + {scalar_cpp_type} scalarValue) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); + const std::string tsString = MEOS::Meos::convertEpochToTimestamp(timestampValue); + std::string wkt = fmt::format("{tnumber_wkt_format}", valueValue, tsString); + Temporal* temp = {tnumber_in_fn}(wkt.c_str()); + if (!temp) return 0; + {return_type} r = {meos_call}(scalarValue, temp); + free(temp); + return r; + }} + catch (const std::exception&) + {{ + return 0; + }} + }}, + value, timestamp, scalar); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# =========================================================================== +# Generalized per-event operator assembler (the "generic" shape). +# +# Composes a physical .cpp from three orthogonal parts instead of a hand-written +# template per shape: +# - INPUT builder : how to construct the primary `Temporal* temp` of a +# given temporal type from per-event fields, +# - EXTRA args : 0+ trailing MEOS args (scalar / static geometry), +# - RETURN marshaler : how the scalar MEOS return becomes the VarVal. +# Scope: Temporal-input operators with a SCALAR return (int/double/bool) — the +# proven lambda-returns-scalar pattern. Variable-sized (text*/GSERIALIZED*) and +# Temporal*-extract returns, and Set/Span/Box inputs, are out of this assembler. +# =========================================================================== + +# input_type -> dict(fields=[(name,cpp)], header, build) where build is C++ that +# defines `Temporal* {var}` (NULL-checked) from the fields. {z} = zero-return literal. +GENERIC_INPUTS = { + "tgeompoint": dict(fields=[("lon", "double"), ("lat", "double"), ("ts", "uint64_t")], header="meos_geo.h", build=( + ' if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0)) return {z};\n' + ' std::string {var}Wkt = fmt::format("SRID=4326;Point({{}} {{}})@{{}}", lon, lat, MEOS::Meos::convertEpochToTimestamp(ts));\n' + ' Temporal* {var} = tgeompoint_in({var}Wkt.c_str());\n' + ' if (!{var}) return {z};\n')), + "tgeometry": dict(fields=[("geomWkt", "VariableSizedData"), ("ts", "uint64_t")], header="meos_geo.h", build=( + ' std::string {var}G(geomWktPtr, geomWktSize);\n' + ' std::string {var}Wkt = {var}G + "@" + MEOS::Meos::convertEpochToTimestamp(ts);\n' + ' Temporal* {var} = tgeometry_in({var}Wkt.c_str());\n' + ' if (!{var}) return {z};\n')), + "tcbuffer": dict(fields=[("lon", "double"), ("lat", "double"), ("radius", "double"), ("ts", "uint64_t")], header="meos_cbuffer.h", build=( + ' if (!(lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0) || radius < 0.0) return {z};\n' + ' std::string {var}Wkt = fmt::format("Cbuffer(Point({{}} {{}}),{{}})@{{}}", lon, lat, radius, MEOS::Meos::convertEpochToTimestamp(ts));\n' + ' Temporal* {var} = tcbuffer_in({var}Wkt.c_str());\n' + ' if (!{var}) return {z};\n')), + "tpose": dict(fields=[("x", "double"), ("y", "double"), ("theta", "double"), ("ts", "uint64_t")], header="meos_pose.h", build=( + ' std::string {var}Wkt = fmt::format("Pose(Point({{}} {{}}),{{}})@{{}}", x, y, theta, MEOS::Meos::convertEpochToTimestamp(ts));\n' + ' Temporal* {var} = tpose_in({var}Wkt.c_str());\n' + ' if (!{var}) return {z};\n')), + "tnpoint": dict(fields=[("rid", "int64_t"), ("frac", "double"), ("ts", "uint64_t")], header="meos_npoint.h", build=( + ' if (frac < 0.0 || frac > 1.0) return {z};\n' + ' std::string {var}Wkt = fmt::format("NPoint({{}},{{}})@{{}}", rid, frac, MEOS::Meos::convertEpochToTimestamp(ts));\n' + ' Temporal* {var} = tnpoint_in({var}Wkt.c_str());\n' + ' if (!{var}) return {z};\n')), + "tfloat": dict(fields=[("value", "double"), ("ts", "uint64_t")], header="meos_geo.h", build=( + ' std::string {var}Wkt = fmt::format("{{}}@{{}}", value, MEOS::Meos::convertEpochToTimestamp(ts));\n' + ' Temporal* {var} = tfloat_in({var}Wkt.c_str());\n' + ' if (!{var}) return {z};\n')), + "tint": dict(fields=[("value", "int32_t"), ("ts", "uint64_t")], header="meos_geo.h", build=( + ' std::string {var}Wkt = fmt::format("{{}}@{{}}", value, MEOS::Meos::convertEpochToTimestamp(ts));\n' + ' Temporal* {var} = tint_in({var}Wkt.c_str());\n' + ' if (!{var}) return {z};\n')), + "tbool": dict(fields=[("value", "bool"), ("ts", "uint64_t")], header="meos_geo.h", build=( + ' std::string {var}Wkt = fmt::format("{{}}@{{}}", value ? "t" : "f", MEOS::Meos::convertEpochToTimestamp(ts));\n' + ' Temporal* {var} = tbool_in({var}Wkt.c_str());\n' + ' if (!{var}) return {z};\n')), + # The efficient mechanism: the operand is an UPSTREAM MEOS value (a windowed + # mini-trip trajectory, or any temporal) carried as a VARSIZED hex-WKB field, + # not rebuilt from per-event scalars. The MEOS function library composes over + # such values like scalar functions over a float. hex-WKB is the (testable, + # ASCII) canonical form; raw WKB is a later optimization. + "wkb_temporal": dict(fields=[("traj", "VariableSizedData")], header="meos_geo.h", build=( + ' std::string {var}Hex(trajPtr, trajSize);\n' + ' Temporal* {var} = temporal_from_hexwkb({var}Hex.c_str());\n' + ' if (!{var}) return {z};\n')), + # A bounding STBox carried as a VARSIZED text field — the per-vehicle + # TSPATIAL_EXTENT output (stbox_out). Used as the first operand of a + # cross-vehicle predicate f(boxA, boxB); the second box is a `box` extra arg + # (also stbox_in). Freed via free(temp) by the generic cleanup. + "stbox_text": dict(fields=[("box", "VariableSizedData")], header="meos_geo.h", build=( + ' std::string {var}S(boxPtr, boxSize);\n' + ' while (!{var}S.empty() && ({var}S.front()==\'\\\'\' || {var}S.front()==\'"\')) {var}S.erase({var}S.begin());\n' + ' while (!{var}S.empty() && ({var}S.back()==\'\\\'\' || {var}S.back()==\'"\')) {var}S.pop_back();\n' + ' STBox* {var} = stbox_in({var}S.c_str());\n' + ' if (!{var}) return {z};\n')), +} + +# return_kind -> (cpp_return_type, nautilus_return, zero_literal, extract_fn|None) +# For a direct scalar return extract_fn is None. For a Temporal*-returning +# transform/restriction whose single-instant result carries a scalar value, the +# extract_fn is the result type's *_start_value accessor (the value at the +# single instant); the wrapper temporal is freed. +GENERIC_RETURNS = { + "int": ("int", "INT32", "0", None), + "double": ("double", "FLOAT64", "0.0", None), + "bool": ("bool", "BOOLEAN", "false", None), + "extract_int": ("int", "INT32", "0", "tint_start_value"), + "extract_double": ("double", "FLOAT64", "0.0", "tfloat_start_value"), + "extract_bool": ("bool", "BOOLEAN", "false", "tbool_start_value"), +} + + +def _generic_field_decl(name, cpp): + """Lambda parameter declaration + the cast expression for one event field.""" + if cpp == "VariableSizedData": + return None # handled specially (pointer + size pair) + return cpp + + +def assemble_generic_physical(op): + """Build the physical .cpp for a 'generic' (build_generic) operator.""" + name = op["nebula_name"] + inp = GENERIC_INPUTS[op["input_type"]] + ret_cpp, _, zero, extract_fn = GENERIC_RETURNS[op["return_kind"]] + extras = op.get("extra_args", []) + + # Ordered (lambda-param) fields: primary input fields, then each extra arg's. + fields = list(inp["fields"]) + headers = {"meos.h", inp["header"]} + call_terms = ["temp"] + parse_lines = [] + box_frees = [] # raw box/span literals to free after the MEOS call + for i, ex in enumerate(extras): + if ex["kind"] == "scalar": + fields.append((f"arg{i}", ex["cpp"])) + call_terms.append(f"arg{i}") + elif ex["kind"] == "geom": + fields.append((f"arg{i}", "VariableSizedData")) + headers.add("meos_geo.h") + parse_lines.append( + f' std::string arg{i}S(arg{i}Ptr, arg{i}Size);\n' + f' while (!arg{i}S.empty() && (arg{i}S.front()==\'\\\'\' || arg{i}S.front()==\'"\')) arg{i}S.erase(arg{i}S.begin());\n' + f' while (!arg{i}S.empty() && (arg{i}S.back()==\'\\\'\' || arg{i}S.back()==\'"\')) arg{i}S.pop_back();\n' + f' MEOS::Meos::StaticGeometry arg{i}G(arg{i}S);\n' + f' if (!arg{i}G.getGeometry()) {{ free(temp); return {zero}; }}\n') + call_terms.append(f"arg{i}G.getGeometry()") + elif ex["kind"] == "box": + # query-literal STBox/TBox/Span parsed from a text constant; freed + # after the call. parser = stbox_in / tbox_in / tstzspan_in; box_type + # = STBox / TBox / Span. + fields.append((f"arg{i}", "VariableSizedData")) + headers.add(ex.get("header", "meos.h")) + parse_lines.append( + f' std::string arg{i}S(arg{i}Ptr, arg{i}Size);\n' + f' while (!arg{i}S.empty() && (arg{i}S.front()==\'\\\'\' || arg{i}S.front()==\'"\')) arg{i}S.erase(arg{i}S.begin());\n' + f' while (!arg{i}S.empty() && (arg{i}S.back()==\'\\\'\' || arg{i}S.back()==\'"\')) arg{i}S.pop_back();\n' + f' {ex["box_type"]}* arg{i}B = {ex["parser"]}(arg{i}S.c_str());\n' + f' if (!arg{i}B) {{ free(temp); return {zero}; }}\n') + call_terms.append(f"arg{i}B") + box_frees.append(f"free(arg{i}B);") + elif ex["kind"] == "wkb_temporal": + # a SECOND temporal operand carried as a VARSIZED hex-WKB field (e.g. + # another per-vehicle aggregate output) — parsed via temporal_from_hexwkb, + # freed after the call. For cross-vehicle f(trajA, trajB). + fields.append((f"arg{i}", "VariableSizedData")) + headers.add("meos_geo.h") + parse_lines.append( + f' std::string arg{i}Hex(arg{i}Ptr, arg{i}Size);\n' + f' Temporal* arg{i}T = temporal_from_hexwkb(arg{i}Hex.c_str());\n' + f' if (!arg{i}T) {{ free(temp); return {zero}; }}\n') + call_terms.append(f"arg{i}T") + box_frees.append(f"free(arg{i}T);") + + # Build the parameterValues casts, lambda params, and invoke args from fields. + casts, lparams, invoke = [], [], [] + idx = 0 + for fn, cpp in fields: + if cpp == "VariableSizedData": + casts.append(f" auto {fn} = parameterValues[{idx}].cast();") + lparams.append(f"const char* {fn}Ptr, uint32_t {fn}Size") + invoke.append(f"{fn}.getContent(), {fn}.getContentSize()") + else: + casts.append(f" auto {fn} = parameterValues[{idx}].cast>();") + lparams.append(f"{cpp} {fn}") + invoke.append(fn) + idx += 1 + n_args = idx + + build = inp["build"].format(var="temp", z=zero) + "".join(parse_lines) + inc = "\n".join(f"#include <{h}>" for h in + ["meos.h"] + sorted(h for h in headers if h != "meos.h")) + + # box_first ops (e.g. above_stbox_tspatial(box, temp)) call with the box/span + # literal before the temporal; the default order is temporal-first. + if op.get("box_first") and len(call_terms) == 2: + call_terms = [call_terms[1], call_terms[0]] + callargs = ", ".join(call_terms) + bf = "".join(f" {x}\n" for x in box_frees) + if extract_fn is None: + call_marshal = (f" {ret_cpp} r = {op['meos_call']}({callargs});\n" + f" free(temp);\n" + f"{bf}" + f" return r;") + else: + # Temporal*-returning transform: result is a single-instant temporal; take + # its value via the result type's *_start_value accessor, free both. + call_marshal = (f" Temporal* res = {op['meos_call']}({callargs});\n" + f" free(temp);\n" + f"{bf}" + f" if (!res) return {zero};\n" + f" {ret_cpp} r = {extract_fn}(res);\n" + f" free(res);\n" + f" return r;") + + # physical-hpp/logical ctor args are PhysicalFunction/LogicalFunction per child. + physical_args = ",\n ".join( + f"PhysicalFunction {fn}Function" for fn, _ in fields) + pushes = "\n".join(f" parameterFunctions.push_back(std::move({fn}Function));" for fn, _ in fields) + registrar = "\n".join( + [f" auto arg{i} = std::move(arguments.childFunctions[{i}]);" for i in range(n_args)] + + [f" return {name}PhysicalFunction(" + ", ".join(f"std::move(arg{i})" for i in range(n_args)) + ");"]) + + return GENERIC_PHYSICAL_TEMPLATE.format( + nebula_name=name, includes=inc, + ctor_physical_args=physical_args, n_args=n_args, ctor_physical_pushes=pushes, + casts="\n".join(casts), lambda_params=",\n ".join(lparams), + return_type=ret_cpp, build=build, call_marshal=call_marshal, + zero=zero, invoke_args=", ".join(invoke), registrar_pushes=registrar) + + +GENERIC_PHYSICAL_TEMPLATE = """\ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" {{ +{includes} +}} + +namespace NES {{ + +{nebula_name}PhysicalFunction::{nebula_name}PhysicalFunction({ctor_physical_args}) +{{ + parameterFunctions.reserve({n_args}); +{ctor_physical_pushes} +}} + +VarVal {nebula_name}PhysicalFunction::execute(const Record& record, ArenaRef& arena) const +{{ + std::vector parameterValues; + parameterValues.reserve(parameterFunctions.size()); + for (const auto& function : parameterFunctions) + {{ + parameterValues.emplace_back(function.execute(record, arena)); + }} + +{casts} + + const auto result = nautilus::invoke( + +[]({lambda_params}) -> {return_type} {{ + try + {{ + MEOS::Meos::ensureMeosInitialized(); +{build} +{call_marshal} + }} + catch (const std::exception&) + {{ + return {zero}; + }} + }}, + {invoke_args}); + + return VarVal(result); +}} + +PhysicalFunctionRegistryReturnType PhysicalFunctionGeneratedRegistrar::Register{nebula_name}PhysicalFunction( + PhysicalFunctionRegistryArguments arguments) +{{ + PRECONDITION(arguments.childFunctions.size() == {n_args}, + "{nebula_name}PhysicalFunction requires {n_args} children but got {{}}", + arguments.childFunctions.size()); +{registrar_pushes} +}} + +}} // namespace NES +""" + + +# =========================================================================== +# Parser-glue dispatch-case templates (one per shape). +# The shape is encoded by the build_* flag; the dispatch block produces a +# LogicalFunction ctor invocation matching the C++ operator's arg order. +# +# Mariana's existing TGEO_AT_STBOX and EDWITHIN_TGEO_GEO blocks are the +# in-tree reference for the constantBuilder→functionBuilder lift pattern. +# =========================================================================== + +# 4-arg shape: lon, lat, ts, geometry (geometry is the only constant — WKT). +DISPATCH_CASE_ONE_TEMPORAL_POINT = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("{sql_token} requires exactly 4 arguments (lon, lat, timestamp, geometry), but got {{}}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + {{ + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + }} + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(lon, lat, timestamp, geometry)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 6-arg shape: lonA, latA, tsA, lonB, latB, tsB (no constants). +DISPATCH_CASE_TWO_TEMPORAL_POINTS = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("{sql_token} requires exactly 6 arguments (lonA, latA, tsA, lonB, latB, tsB), but got {{}}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(lonA, latA, tsA, lonB, latB, tsB)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 8-arg shape: xA, yA, thetaA, tsA, xB, yB, thetaB, tsB — two tpose instants, +# each lifted to a tgeompoint via tpose_to_tpoint at run time (W15 composition). +DISPATCH_CASE_TWO_TPOSE_POINTS = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("{sql_token} requires exactly 8 arguments (xA, yA, thetaA, tsA, xB, yB, thetaB, tsB), but got {{}}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto thetaA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto yA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto xA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(xA, yA, thetaA, tsA, xB, yB, thetaB, tsB)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 5-arg shape: lon, lat, ts, geometry, dist (both geometry and dist are constants). +# Constant lift uses mariana's pattern: TRUE/FALSE → BOOLEAN, strtod-clean → FLOAT64, else → VARSIZED. +DISPATCH_CASE_ONE_TEMPORAL_POINT_WITH_DIST = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("{sql_token} requires exactly 5 arguments (lon, lat, timestamp, geometry, distance), but got {{}}", argCount); + + /* Lift constants (geometry + distance) — same shape as EDWITHIN_TGEO_GEO */ + while (!helpers.top().constantBuilder.empty()) + {{ + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + const auto upperValue = Util::toUpperCase(constantValue); + if (upperValue == "TRUE" || upperValue == "FALSE") + {{ + dataType = DataTypeProvider::provideDataType(DataType::Type::BOOLEAN); + }} + else + {{ + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + }} + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + }} + + /* After lift: [lon, lat, ts, distance, geometry] (geometry pushed last because lifted last in LIFO) */ + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(lon, lat, timestamp, geometry, dist)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 7-arg shape: lonA, latA, tsA, lonB, latB, tsB, dist (only dist is constant). +DISPATCH_CASE_TWO_TEMPORAL_POINTS_WITH_DIST = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 7) + throw InvalidQuerySyntax("{sql_token} requires exactly 7 arguments (lonA, latA, tsA, lonB, latB, tsB, distance), but got {{}}", argCount); + + /* Lift the distance constant */ + while (!helpers.top().constantBuilder.empty()) + {{ + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + }} + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(lonA, latA, tsA, lonB, latB, tsB, dist)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + + +# 6-arg shape: lon, lat, radius, ts, geometry, dist — tcbuffer × static geom + dist. +DISPATCH_CASE_TCBUFFER_POINT_WITH_DIST = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 6) + throw InvalidQuerySyntax("{sql_token} requires exactly 6 arguments (lon, lat, radius, timestamp, blob, distance), but got {{}}", argCount); + + while (!helpers.top().constantBuilder.empty()) + {{ + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + }} + + auto blobLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto distLast = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(lon, lat, radius, timestamp, blobLast, distLast)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 9-arg shape: lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist — two tcbuffers + dist. +DISPATCH_CASE_TWO_TCBUFFER_POINTS_WITH_DIST = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 9) + throw InvalidQuerySyntax("{sql_token} requires exactly 9 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, distance), but got {{}}", argCount); + + while (!helpers.top().constantBuilder.empty()) + {{ + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::FLOAT64), std::move(v))); + }} + + auto dist = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB, dist)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 8-arg shape: lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB (no constants). +DISPATCH_CASE_TWO_TCBUFFER_POINTS = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 8) + throw InvalidQuerySyntax("{sql_token} requires exactly 8 arguments (lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB), but got {{}}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radiusA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto latA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lonA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(lonA, latA, radiusA, tsA, lonB, latB, radiusB, tsB)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 5-arg shape: lon, lat, radius, ts, geometry — tcbuffer × static geom. +# Geometry is the only constant (lifted to FLOAT64 / VARSIZED via the same lift +# pattern as the existing with-dist templates). +DISPATCH_CASE_TCBUFFER_POINT = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 5) + throw InvalidQuerySyntax("{sql_token} requires exactly 5 arguments (lon, lat, radius, timestamp, geometry), but got {{}}", argCount); + + /* Lift the WKT constant into the function builder */ + while (!helpers.top().constantBuilder.empty()) + {{ + auto v = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + helpers.top().functionBuilder.emplace_back( + ConstantValueLogicalFunction( + DataTypeProvider::provideDataType(DataType::Type::VARSIZED), std::move(v))); + }} + + auto geometry = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto radius = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lat = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto lon = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(lon, lat, radius, timestamp, geometry)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 3-arg shape: value, ts, scalar (scalar may be FLOAT64 or INT32, only one constant). +DISPATCH_CASE_TNUMBER_POINT_WITH_SCALAR = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 3) + throw InvalidQuerySyntax("{sql_token} requires exactly 3 arguments (value, timestamp, scalar), but got {{}}", argCount); + + /* Lift the scalar constant — accept FLOAT64 (strtod-clean) and INT32 */ + while (!helpers.top().constantBuilder.empty()) + {{ + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + }} + + auto scalar = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto timestamp = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto value = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(value, timestamp, scalar)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + +# 4-arg shape: valueA, tsA, valueB, tsB (no constants). +DISPATCH_CASE_TWO_TNUMBER_POINTS = """\ + /* BEGIN CODEGEN PARSER GLUE: {sql_token} */ + case AntlrSQLLexer::{sql_token}: + {{ + const auto argCount = context->expression().size(); + if (argCount != 4) + throw InvalidQuerySyntax("{sql_token} requires exactly 4 arguments (valueA, tsA, valueB, tsB), but got {{}}", argCount); + + auto tsB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueB = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto tsA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + auto valueA = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back(); + + helpers.top().functionBuilder.emplace_back( + {nebula_name}LogicalFunction(valueA, tsA, valueB, tsB)); + }} + break; + /* END CODEGEN PARSER GLUE: {sql_token} */ +""" + + +def dispatch_case_for(op): + """Pick the dispatch-case template that matches an operator's shape.""" + if op.get("build_two_temporal_points_with_dist"): + return DISPATCH_CASE_TWO_TEMPORAL_POINTS_WITH_DIST + if op.get("build_temporal_point_with_dist"): + return DISPATCH_CASE_ONE_TEMPORAL_POINT_WITH_DIST + if op.get("build_two_temporal_points"): + return DISPATCH_CASE_TWO_TEMPORAL_POINTS + if op.get("build_two_tpose_points_via_composition"): + return DISPATCH_CASE_TWO_TPOSE_POINTS + if op.get("build_tnpoint_point_via_composition"): + # 4-arg SQL shape (rid, fraction, ts, geometry) — same arity as a + # one-temporal-point op; the parser only pops/forwards by arity. + return DISPATCH_CASE_ONE_TEMPORAL_POINT + if op.get("build_two_tnpoint_points_via_composition"): + # 6-arg SQL shape (ridA, fracA, tsA, ridB, fracB, tsB) — same arity + # as a two-temporal-points op. + return DISPATCH_CASE_TWO_TEMPORAL_POINTS + # dwithin (W20): the with-dist composition shapes reuse existing with-dist + # dispatches by arity + constant pattern (geometry+dist or dist-only lifted). + if op.get("build_tpose_point_with_dist_via_composition"): + # 6-arg: x, y, theta, ts (cols) + geometry, dist (constants) — same + # shape as tcbuffer × geom + dist. + return DISPATCH_CASE_TCBUFFER_POINT_WITH_DIST + if op.get("build_two_tpose_points_with_dist_via_composition"): + # 9-arg: 8 cols + dist constant — same shape as two-tcbuffer + dist. + return DISPATCH_CASE_TWO_TCBUFFER_POINTS_WITH_DIST + if op.get("build_tnpoint_point_with_dist_via_composition"): + # 5-arg: rid, fraction, ts (cols) + geometry, dist (constants). + return DISPATCH_CASE_ONE_TEMPORAL_POINT_WITH_DIST + if op.get("build_two_tnpoint_points_with_dist_via_composition"): + # 7-arg: 6 cols + dist constant. + return DISPATCH_CASE_TWO_TEMPORAL_POINTS_WITH_DIST + if op.get("build_temporal_point") or op.get("build_temporal_point_restriction"): + # Both shapes share the same 4-arg dispatch (lon, lat, ts, geom); + # only the physical-cpp body differs (filter-predicate int return vs. + # restriction-survival int return). + return DISPATCH_CASE_ONE_TEMPORAL_POINT + if op.get("build_tcbuffer_point") or op.get("build_tcbuffer_point_cbuffer") \ + or op.get("build_tpose_point_via_composition"): + # All three shapes share the same 5-arg dispatch (lon/x, lat/y, radius/theta, ts, blob); + # only the physical-cpp body differs (blob parsed as GSERIALIZED vs Cbuffer; per-event + # type construction is tcbuffer vs tpose with optional tpose_to_tpoint composition). + return DISPATCH_CASE_TCBUFFER_POINT + if op.get("build_two_tcbuffer_points"): + return DISPATCH_CASE_TWO_TCBUFFER_POINTS + if op.get("build_tcbuffer_point_with_dist") or op.get("build_tcbuffer_point_cbuffer_with_dist"): + # Same 6-arg SQL dispatch for both — only physical-cpp body differs (blob parser). + return DISPATCH_CASE_TCBUFFER_POINT_WITH_DIST + if op.get("build_two_tcbuffer_points_with_dist"): + return DISPATCH_CASE_TWO_TCBUFFER_POINTS_WITH_DIST + if op.get("build_tnumber_point_with_scalar") or op.get("build_tnumber_scalar_first"): + # scalar-first reuses the same 3-arg (value, ts, scalar) SQL dispatch; + # only the physical-cpp body differs (MEOS call arg order). + return DISPATCH_CASE_TNUMBER_POINT_WITH_SCALAR + if op.get("build_two_tnumber_points"): + return DISPATCH_CASE_TWO_TNUMBER_POINTS + return None + + +def _generic_dispatch_case(op): + """Parser dispatch case for a 'generic' operator. Arity is baked in (n = + number of event fields); lifts string/number constants (geometry blobs, + scalars) then pops n children in reverse and builds the LogicalFunction. + Returns the final C++ string (no further .format).""" + n = len(op["args"]) + tok, name = op["sql_token"], op["nebula_name"] + pops = "\n".join( + f" auto a{i} = helpers.top().functionBuilder.back(); helpers.top().functionBuilder.pop_back();" + for i in range(n - 1, -1, -1)) + ctor_args = ", ".join(f"a{i}" for i in range(n)) + return f""" /* BEGIN CODEGEN PARSER GLUE: {tok} */ + case AntlrSQLLexer::{tok}: + {{ + const auto argCount = context->expression().size(); + if (argCount != {n}) + throw InvalidQuerySyntax("{tok} requires exactly {n} arguments, but got {{}}", argCount); + + while (!helpers.top().constantBuilder.empty()) + {{ + auto constantValue = std::move(helpers.top().constantBuilder.back()); + helpers.top().constantBuilder.pop_back(); + DataType dataType; + char* endPtr = nullptr; + std::strtod(constantValue.c_str(), &endPtr); + if (endPtr != nullptr && *endPtr == '\\0') + dataType = DataTypeProvider::provideDataType(DataType::Type::FLOAT64); + else + dataType = DataTypeProvider::provideDataType(DataType::Type::VARSIZED); + helpers.top().functionBuilder.emplace_back(ConstantValueLogicalFunction(dataType, std::move(constantValue))); + }} + +{pops} + + helpers.top().functionBuilder.emplace_back({name}LogicalFunction({ctor_args})); + }} + break; + /* END CODEGEN PARSER GLUE: {tok} */ +""" + + +# =========================================================================== +# Idempotent injectors — each scans for a per-op marker and inserts only +# if not present, so re-runs are safe. +# =========================================================================== + +def inject_cmake_entries(operators, output_root: Path) -> int: + """Append per-op `add_plugin(...)` entries to the Meos CMakeLists files + (logical + physical layers). Idempotent: skips ops already listed.""" + n_added = 0 + for layer in ("logical", "physical"): + cml = output_root / f"nes-{layer}-operators/src/Functions/Meos/CMakeLists.txt" + if not cml.exists(): + sys.stderr.write(f" ! cmake-entries: {cml} not found, skipping {layer} layer\n") + continue + body = cml.read_text() + layer_suffix = "Logical" if layer == "logical" else "Physical" + new_lines = [] + for op in operators: + entry = ( + f"add_plugin({op['nebula_name']} {layer_suffix}Function " + f"nes-{layer}-operators {op['nebula_name']}{layer_suffix}Function.cpp)" + ) + if entry in body or f"add_plugin({op['nebula_name']} {layer_suffix}Function" in body: + continue + new_lines.append(entry) + if new_lines: + with cml.open("a") as f: + f.write("\n".join(new_lines) + "\n") + sys.stderr.write(f" ✓ cmake-entries ({layer}): appended {len(new_lines)} entry(ies)\n") + n_added += len(new_lines) + return n_added + + +def inject_g4(operators, g4_path: Path) -> int: + """Inject lexer-token + functionName-alternation entries into AntlrSQL.g4. + Idempotent: skips tokens already present.""" + if not g4_path.exists(): + sys.stderr.write(f" ! g4: {g4_path} not found, skipping\n") + return 0 + body = g4_path.read_text() + n_added = 0 + + # 1) Lexer-token entries — insert just before the WATERMARK: lexer token. + new_tokens = [] + for op in operators: + tok = op["sql_token"] + if re.search(rf"^{re.escape(tok)}\s*:", body, re.MULTILINE): + continue + new_tokens.append( + f"{tok}: '{tok}' | '{tok.lower()}';" + ) + if new_tokens: + anchor_re = re.compile(r"^WATERMARK:.*$", re.MULTILINE) + m = anchor_re.search(body) + if m is None: + sys.stderr.write(f" ! g4: WATERMARK lexer anchor not found; cannot inject tokens\n") + else: + insertion = "/* BEGIN CODEGEN LEXER TOKENS */\n" + "\n".join(new_tokens) + "\n/* END CODEGEN LEXER TOKENS */\n" + # If the BEGIN marker already exists, append inside that block; else insert before WATERMARK. + if "/* BEGIN CODEGEN LEXER TOKENS */" in body: + body = re.sub( + r"(/\* BEGIN CODEGEN LEXER TOKENS \*/\n)(.*?)(/\* END CODEGEN LEXER TOKENS \*/)", + lambda mm: mm.group(1) + mm.group(2) + "\n".join(new_tokens) + "\n" + mm.group(3), + body, + count=1, + flags=re.DOTALL, + ) + else: + body = body[: m.start()] + insertion + body[m.start():] + n_added += len(new_tokens) + sys.stderr.write(f" ✓ g4 lexer-tokens: added {len(new_tokens)} token(s)\n") + + # 2) functionName: alternation — append missing tokens before the trailing ';'. + fn_re = re.compile(r"^functionName:\s*([^;]+);", re.MULTILINE) + m = fn_re.search(body) + if m is None: + sys.stderr.write(f" ! g4: functionName production not found\n") + else: + alternation = m.group(1) + new_alts = [] + for op in operators: + tok = op["sql_token"] + if re.search(rf"\b{re.escape(tok)}\b", alternation): + continue + new_alts.append(tok) + if new_alts: + new_alt_text = alternation.rstrip() + " | " + " | ".join(new_alts) + body = body[: m.start()] + f"functionName: {new_alt_text};" + body[m.end():] + sys.stderr.write(f" ✓ g4 functionName: added {len(new_alts)} alternative(s)\n") + + g4_path.write_text(body) + return n_added + + +def inject_parser_cpp(operators, cpp_path: Path) -> int: + """Inject #include + dispatch-case block into AntlrSQLQueryPlanCreator.cpp. + Idempotent: skips when the per-op BEGIN marker is already present.""" + if not cpp_path.exists(): + sys.stderr.write(f" ! parser-cpp: {cpp_path} not found, skipping\n") + return 0 + body = cpp_path.read_text() + n_added = 0 + + # 1) Per-op #include — append after the last existing Meos LogicalFunction include. + new_includes = [] + for op in operators: + inc = f"#include " + if inc in body: + continue + new_includes.append(inc) + if new_includes: + # Insert immediately after the last #include line. + meos_inc_re = re.compile(r"(^#include ]+>\s*\n)+", re.MULTILINE) + matches = list(meos_inc_re.finditer(body)) + if not matches: + sys.stderr.write(f" ! parser-cpp: could not find Meos include anchor\n") + else: + last = matches[-1] + body = body[: last.end()] + "\n".join(new_includes) + "\n" + body[last.end():] + sys.stderr.write(f" ✓ parser-cpp includes: added {len(new_includes)}\n") + + # 2) Per-op dispatch cases — insert just before the `default:` of the + # switch that already contains the TGEO_AT_STBOX case. + cases_block = [] + for op in operators: + marker = f"/* BEGIN CODEGEN PARSER GLUE: {op['sql_token']} */" + if marker in body: + continue + # Also skip if a pre-existing hand-written case for this token already + # exists (no marker, but a `case AntlrSQLLexer::TOKEN:` line is present). + if re.search(rf"case\s+AntlrSQLLexer::{re.escape(op['sql_token'])}\s*:", body): + sys.stderr.write( + f" ! parser-cpp: pre-existing hand-written case for {op['sql_token']} detected; " + f"skipping codegen injection (will not duplicate)\n" + ) + continue + if op.get("build_generic"): + case_str = _generic_dispatch_case(op) # arity baked in; final string + else: + tmpl = dispatch_case_for(op) + if tmpl is None: + sys.stderr.write(f" ! parser-cpp: {op['nebula_name']} has no dispatch shape, skipping case\n") + continue + case_str = tmpl.format(sql_token=op["sql_token"], nebula_name=op["nebula_name"]) + cases_block.append(case_str) + n_added += 1 + if cases_block: + # Find the insertion point: prefer just after the LAST existing + # `/* END CODEGEN PARSER GLUE: ... */` marker (so successive codegen + # runs cluster their cases), else fall back to inserting before the + # `default:` that immediately follows the TGEO_AT_STBOX case block. + last_end_re = re.compile(r"/\* END CODEGEN PARSER GLUE: [^*]+\*/") + ends = list(last_end_re.finditer(body)) + if ends: + insert_at = ends[-1].end() + body = body[:insert_at] + "\n" + "\n".join(cases_block) + body[insert_at:] + sys.stderr.write(f" ✓ parser-cpp dispatch: added {len(cases_block)} case(s) after last codegen marker\n") + else: + anchor_re = re.compile( + r"(case AntlrSQLLexer::TGEO_AT_STBOX:[\s\S]+?\n\s*break;\n)(\s*default:)", + ) + m = anchor_re.search(body) + if m is None: + sys.stderr.write(f" ! parser-cpp: no anchor (TGEO_AT_STBOX→default or codegen END marker) found\n") + else: + insertion = m.group(1) + "\n" + "\n".join(cases_block) + "\n" + m.group(2) + body = body[: m.start()] + insertion + body[m.end():] + sys.stderr.write(f" ✓ parser-cpp dispatch: added {len(cases_block)} case(s) before default:\n") + + cpp_path.write_text(body) + return n_added + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--input", required=True, help="Path to JSON descriptor file") + parser.add_argument("--output-root", required=True, help="MobilityNebula repo root") + parser.add_argument("--no-parser-glue", action="store_true", + help="Skip .g4 + parser .cpp injection (default: inject)") + parser.add_argument("--no-cmake-entries", action="store_true", + help="Skip CMakeLists.txt injection (default: inject)") + args = parser.parse_args() + + with open(args.input) as f: + config = json.load(f) + + output_root = Path(args.output_root).resolve() + if not (output_root / "nes-logical-operators").exists(): + sys.exit(f"ERROR: {output_root} does not look like a MobilityNebula root (no nes-logical-operators/)") + + operators = config["operators"] + sys.stderr.write(f"Emitting {len(operators)} operator(s):\n\n") + for op in operators: + emit_operator(op, output_root) + + if not args.no_cmake_entries: + sys.stderr.write("\nCMakeLists.txt:\n") + inject_cmake_entries(operators, output_root) + + if not args.no_parser_glue: + sys.stderr.write("\nParser glue:\n") + inject_g4(operators, output_root / "nes-sql-parser/AntlrSQL.g4") + inject_parser_cpp(operators, output_root / "nes-sql-parser/src/AntlrSQLQueryPlanCreator.cpp") + + sys.stderr.write( + f"\nDone. {len(operators) * 4} files emitted " + f"(or 3 + .cpp-skipped for shapes without a physical-cpp template).\n" + ) + + +if __name__ == "__main__": + main() diff --git a/tools/streaming_parity/README.md b/tools/streaming_parity/README.md new file mode 100644 index 0000000000..2ed223300d --- /dev/null +++ b/tools/streaming_parity/README.md @@ -0,0 +1,43 @@ +# Streaming-parity harness — PROVEN coverage of the MEOS surface + +Streaming-platform sibling of MobilityDB's cross-type parity audit +(`tools/parity_audit/`, MobilityDB #1110). Methodology: +[`doc/methodology/streaming_parity.md`](../../doc/methodology/streaming_parity.md). + +**Measures parity, does not assert it.** A MEOS function counts as covered by a +platform only when a test passes (L3) — not because it is *wirable* or merely +*registered*. Run over an **accumulated-PR build** (all open PRs merged) so the +intended surface is measured, not stale `master`. + +## Layers + +- **L1 EXPORTED** — symbol in the pinned `libmeos` (`nm -D`). +- **L2 WIRED** — an operator/UDF calls it (Nebula `meos_call` + SQL token; + Flink/Kafka facade method). +- **L3 PROVEN** — a test exercising it passes (Nebula systest; Flink/Kafka JUnit). + +Only L3 counts. `sequence-only` / `io-meta` / `ambiguous` / `internal` tiers are +reason-marked non-streamable — never gaps. + +## Usage + +```bash +# 1. on the accumulated Nebula build, run systests -> passing basenames +for t in nes-systests/function/meos/*.test; do + build-/nes-systests/systest/systest -t "$t" 2>&1 | grep -q "All queries passed" \ + && basename "$t" .test +done > passing.txt + +# 2. adapter -> coverage feed (function{proven|wired}) +python3 tools/streaming_parity/adapters/nebula.py --root . --passing passing.txt > nebula.feed.tsv + +# 3. measure against the streamable catalog +python3 tools/streaming_parity/streaming_parity.py \ + --catalog streaming-relevance-baseline.json \ + --platform NebulaStream --feed nebula.feed.tsv +``` + +The streamable catalog (`streaming-relevance-baseline.json`) is the v4 +streaming-tier classification of MEOS-API's `meos-idl.json`. Flink/Kafka add an +adapter (`adapters/flink.py`, `adapters/kafka.py`) emitting the same feed shape +from `javap`/reflection (L2) × the JUnit report (L3); the core is shared. diff --git a/tools/streaming_parity/adapters/jvm_facade.py b/tools/streaming_parity/adapters/jvm_facade.py new file mode 100644 index 0000000000..8a4a5ffbab --- /dev/null +++ b/tools/streaming_parity/adapters/jvm_facade.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +"""JVM-facade adapter (Flink / Kafka) for the streaming-parity harness. + +The Flink/Kafka codegen emits a tier-aware MEOS facade as +`MeosOps.java` classes whose `public static (…)` methods are +named after the MEOS function. So: + + L2 WIRED — every `public static` facade method name. + L3 PROVEN — a wired method exercised by a JUnit test that PASSED. Pass the + passing methods (one MEOS-fn name per line) via --passing, derived + from the Surefire/JUnit report of an ACCUMULATED-PR Maven build. + With no per-function tests, L3 is empty — the honest result. + +Usage: + jvm_facade.py --facade-dir <…/meos> [--passing passing.txt] > feed.tsv +""" +from __future__ import annotations +import argparse +import os +import re +import sys + +METHOD = re.compile(r"public static [A-Za-z0-9_<>\[\].,? ]+?\b([a-z][a-z0-9_]+)\s*\(") + + +def facade_methods(d): + names = set() + for root, _, files in os.walk(d): + for f in files: + if f.startswith("MeosOps") and f.endswith(".java"): + for m in METHOD.finditer(open(os.path.join(root, f)).read()): + names.add(m.group(1)) + return names + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--facade-dir", required=True) + ap.add_argument("--passing", help="file: one passing-tested MEOS fn name per line") + a = ap.parse_args() + wired = facade_methods(a.facade_dir) + proven = set() + if a.passing and os.path.exists(a.passing): + proven = {ln.strip() for ln in open(a.passing) if ln.strip()} & wired + for fn in sorted(wired): + print(f"{fn}\t{'proven' if fn in proven else 'wired'}") + sys.stderr.write(f"[jvm adapter] wired={len(wired)} proven={len(proven)}\n") + + +if __name__ == "__main__": + main() diff --git a/tools/streaming_parity/adapters/nebula.py b/tools/streaming_parity/adapters/nebula.py new file mode 100644 index 0000000000..72fafbf350 --- /dev/null +++ b/tools/streaming_parity/adapters/nebula.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python3 +"""NebulaStream adapter for the streaming-parity harness. + +Introspects an ACCUMULATED-PR Nebula build to emit a coverage feed +(`function{proven|wired}`) consumed by streaming_parity.py. + + L2 WIRED — every distinct MEOS function called by a generated/hand-written + operator (the `meos_call` inside each *PhysicalFunction.cpp). + L3 PROVEN — a wired function whose operator is exercised by a systest that + PASSED. Mapping: systest SQL token (TEMPORAL_…) -> operator NAME + (PascalCase of the token) -> its meos_call. + +Pass the list of green systests (one basename per line, no extension) via +--passing; produce it by running the `systest` binary over +nes-systests/function/meos/ on the accumulated build. Functions called only by +operators with no passing systest come out as `wired` — the honest backlog. +""" +from __future__ import annotations +import argparse +import os +import re +import sys + +CALL_RE = re.compile(r"\b([a-z][a-z0-9_]*)\s*\(", ) + +# A call counts as the operator's backing MEOS function iff it is an actual +# MEOS *streamable* symbol — i.e. it is in the parity surface itself. This is +# measured-not-guessed and family-agnostic: spatial-rels, distance, comparison, +# arithmetic, accessors all qualify automatically, with no per-family regex to +# maintain. Input constructors (tfloat_in, tint_in, tcbuffer_in, …) are NOT in +# the streamable surface (io-meta) so they self-exclude. The two type-conversion +# helpers below ARE streamable: they are composition plumbing (and not the wired +# op) ONLY when they co-occur with another streamable call in the same operator +# (e.g. tpose_to_tpoint before a tgeo spatial-rel). When such a helper is an +# operator's SOLE streamable call, the operator is a dedicated conversion (e.g. +# TNPOINT_TO_TGEOMPOINT_EXP materializing a network-resolved trajectory) and the +# helper IS its wired op — see operator_calls(). +CONVERSION_HELPERS = {"tpose_to_tpoint", "tnpoint_to_tgeompoint"} + + +def load_streamable(path): + return {ln.strip() for ln in open(path) if ln.strip()} + + +def operator_calls(root, streamable): + """Map operator NAME -> set(meos_call). NAME taken from the file stem + (…PhysicalFunction.cpp -> the operator name). A call counts iff it is a + streamable MEOS symbol and not a composition-plumbing conversion.""" + name2calls = {} + dirs = ["nes-physical-operators/src/Functions/Meos", + "nes-physical-operators/src/Aggregation/Function/Meos"] + for d in dirs: + full = os.path.join(root, d) + if not os.path.isdir(full): + continue + for f in os.listdir(full): + if not f.endswith("PhysicalFunction.cpp"): + continue + name = f[:-len("PhysicalFunction.cpp")] + txt = open(os.path.join(full, f)).read() + # find the MEOS backing call: the call assigned to result/returned + calls = set() + helpers = set() + for m in CALL_RE.finditer(txt): + fn = m.group(1) + if fn not in streamable: + continue + (helpers if fn in CONVERSION_HELPERS else calls).add(fn) + # A conversion helper is plumbing and is dropped, EXCEPT when the + # operator is named for it (a dedicated conversion operator, e.g. + # TnpointToTgeompointExp -> tnpoint_to_tgeompoint): there the helper + # IS the operator's headline op. (The expand substrate's accumulator + # calls temporal_append_tinstant/temporal_merge co-occur in every + # aggregate, so co-occurrence alone cannot distinguish the two.) + snake = re.sub(r"(? tlengthexp; the operator key + # TLengthExpAggregation, minus its Aggregation suffix, -> tlengthexp). This + # covers every family (per-event, …_EXP, …_WKB, …_EXTENT/UNION, TNPOINT_…) + # without a per-family pattern — the parser-dispatch token map only captures + # per-event functions, not windowed aggregates. + def _norm(s): + return s.replace("_", "").lower() + norm2name = {} + for k in name2calls: + base = k[:-len("Aggregation")] if k.endswith("Aggregation") else k + norm2name[_norm(base)] = k + + passing = set() + if a.passing and os.path.exists(a.passing): + passing = {ln.strip() for ln in open(a.passing) if ln.strip()} + + proven = set() + sysdir = os.path.join(a.root, a.systests) + if os.path.isdir(sysdir): + for f in os.listdir(sysdir): + if not f.endswith(".test"): + continue + base = f[:-len(".test")] + if passing and base not in passing: + continue + # The first called UPPER_SNAKE token that resolves to an operator. + for cand in _all_tokens(os.path.join(sysdir, f)): + name = norm2name.get(_norm(cand)) + if name: + proven |= name2calls[name] + break + + for fn in sorted(wired): + print(f"{fn}\t{'proven' if fn in proven else 'wired'}") + sys.stderr.write(f"[nebula adapter] operators={len(name2calls)} wired-calls={len(wired)} " + f"proven-calls={len(proven)} passing-systests={len(passing) or 'all'}\n") + + +if __name__ == "__main__": + main() diff --git a/tools/streaming_parity/callability/FacadeCallability.java b/tools/streaming_parity/callability/FacadeCallability.java new file mode 100644 index 0000000000..d68de328de --- /dev/null +++ b/tools/streaming_parity/callability/FacadeCallability.java @@ -0,0 +1,81 @@ +import java.io.*; +import java.lang.reflect.*; +import java.util.*; +import jnr.ffi.Pointer; + +/** + * CALLABILITY test for the MobilityFlink / MobilityKafka MEOS facade (the + * shared JNR-FFI `MeosOps*.java` surface generated over JMEOS). + * + * Verifies the BINDING CONNECTION per function — that the platform can invoke + * the MEOS function on real libmeos (symbol resolves, args marshal in, result + * marshals back) — NOT that the result is correct (correctness is inherited + * from MEOS's own PostgreSQL regression suite, which executes the same C code). + * + * Per MeosOps class: build the group's primary value from a canonical + * literal, then invoke every public-static method (Pointer args <- the primary + * value, primitives <- samples, String <- the literal). A method that returns + * without a binding failure is CALLABLE; it is printed (append+flush) to the + * output file. ONE class per JVM (crash isolation): a MEOS error on a synthetic + * input can abort the JVM — that abort still means the call reached MEOS + * (callable), and per-class isolation preserves every result flushed before it. + * + * args: + */ +public class FacadeCallability { + static final Map LIT = new HashMap<>(); + static { + LIT.put("bigintset","{1, 2, 3}"); LIT.put("bigintspan","[1, 5)"); LIT.put("bigintspanset","{[1, 3), [5, 7)}"); + LIT.put("intset","{1, 2, 3}"); LIT.put("intspan","[1, 5)"); LIT.put("intspanset","{[1, 3), [5, 7)}"); + LIT.put("floatset","{1.5, 2.5}"); LIT.put("floatspan","[1.5, 2.5)"); LIT.put("floatspanset","{[1.5, 2.5)}"); + LIT.put("dateset","{2000-01-01, 2000-01-02}"); LIT.put("datespan","[2000-01-01, 2000-01-05)"); LIT.put("datespanset","{[2000-01-01, 2000-01-03)}"); + LIT.put("tstzset","{2000-01-01, 2000-01-02}"); LIT.put("tstzspan","[2000-01-01, 2000-01-02)"); LIT.put("tstzspanset","{[2000-01-01, 2000-01-02)}"); + LIT.put("textset","{\"a\", \"b\"}"); LIT.put("text","hello"); + LIT.put("tint","5@2000-01-01"); LIT.put("tfloat","1.5@2000-01-01"); LIT.put("tbool","true@2000-01-01"); LIT.put("ttext","\"hi\"@2000-01-01"); + LIT.put("tgeompoint","SRID=4326;POINT(1 2)@2000-01-01"); LIT.put("tgeogpoint","SRID=4326;POINT(1 2)@2000-01-01"); + LIT.put("stbox","STBOX XT(((1,1),(2,2)),[2000-01-01,2000-01-02])"); LIT.put("tbox","TBOX XT([1,2],[2000-01-01,2000-01-02])"); + LIT.put("cbuffer","Cbuffer(Point(1 1), 2)"); LIT.put("cbufferset","{Cbuffer(Point(1 1), 2)}"); + LIT.put("npoint","NPoint(1, 0.5)"); LIT.put("npointset","{NPoint(1, 0.5)}"); LIT.put("nsegment","NSegment(1, 0.2, 0.8)"); + LIT.put("tnpoint","NPoint(1, 0.5)@2000-01-01"); + LIT.put("pose","Pose(Point(1 1), 0.5)"); LIT.put("poseset","{Pose(Point(1 1), 0.5)}"); + LIT.put("geometry","SRID=4326;POINT(1 2)"); LIT.put("geography","SRID=4326;POINT(1 2)"); + } + static String classPrimary(String cls) { return cls.substring("MeosOps".length()).toLowerCase(); } + + public static void main(String[] args) throws Exception { + String pkg = args[0], className = args[1]; + PrintWriter w = new PrintWriter(new FileWriter(args[2], true), true); + Class.forName("functions.GeneratedFunctions").getMethod("meos_initialize").invoke(null); + if (className.startsWith("MeosOpsFree") || className.equals("MeosOpsRuntime")) return; + Class c = Class.forName(pkg + "." + className); + String prim = classPrimary(className), lit = LIT.get(prim); + Pointer primary = null; + if (lit != null) try { + Method in = c.getMethod(prim + "_in", String.class); + primary = (Pointer) in.invoke(null, lit); + if (primary != null) w.println(prim + "_in"); + } catch (Throwable t) {} + for (Method m : c.getDeclaredMethods()) { + if (!Modifier.isStatic(m.getModifiers()) || !Modifier.isPublic(m.getModifiers())) continue; + Object[] a = synth(m.getParameterTypes(), primary, lit); + if (a == null) continue; // can't synthesize args -> leave wired-only + try { m.invoke(null, a); w.println(m.getName()); w.flush(); } catch (Throwable t) {} + } + w.close(); + } + static Object[] synth(Class[] pt, Pointer primary, String lit) { + Object[] a = new Object[pt.length]; + for (int i = 0; i < pt.length; i++) { + Class t = pt[i]; + if (t == Pointer.class) { if (primary == null) return null; a[i] = primary; } + else if (t == int.class) a[i] = 1; + else if (t == long.class) a[i] = 1L; + else if (t == double.class) a[i] = 1.0; + else if (t == float.class) a[i] = 1.0f; + else if (t == boolean.class) a[i] = true; + else if (t == String.class) a[i] = (lit != null ? lit : "1"); + else return null; + } + return a; + } +} diff --git a/tools/streaming_parity/callability/PerMethodCallability.java b/tools/streaming_parity/callability/PerMethodCallability.java new file mode 100644 index 0000000000..a1ced98756 --- /dev/null +++ b/tools/streaming_parity/callability/PerMethodCallability.java @@ -0,0 +1,319 @@ +import java.io.*; +import java.lang.reflect.*; +import java.util.*; +import jnr.ffi.Pointer; +import jnr.ffi.Memory; +import jnr.ffi.Runtime; +import java.time.OffsetDateTime; +import java.time.LocalDateTime; + +/** + * Type-aware per-method CALLABILITY harness for the Flink/Kafka MEOS facade. + * + * Tests ONE (class, method) per JVM (so a type-mismatch SIGSEGV or a native + * exit(1) on a MEOS semantic error only loses the method under test, never the + * rest of the run). The driver (run_callability.sh) classifies the outcome: + * reached native MEOS -> CALLABLE (clean return "OK"; a caught MEOS error + * "MEOSERR"; a native exit on a semantic + * error; or a signal, rc>128) + * "BINDFAIL" -> NOT callable (UnsatisfiedLink / NoSuchMethod / + * marshalling — the binding itself fails) + * "NOMETHOD"/"NOSYNTH" -> untestable here (method not found / args not + * literal-synthesizable) -> skip + * + * The "connectors": each Pointer argument is built from a per-TYPE sample, with + * the type inferred from the function-name tokens (acontains_geo_tgeo -> + * [geometry, tgeompoint]; tdwithin_tgeo_tgeo -> [tgeompoint, tgeompoint]). TOK + * maps a name-segment to (a facade `*_in` constructor, a canonical literal); a + * sample is built once per needed type, then assigned positionally to the + * Pointer args. This is what lifts confirmed callability from the + * single-primary-value floor (331) to the multi-Pointer spatial-relations and + * span/set/box operators (1472 of 1949 streamable). Types whose constructor is + * ABSENT from the linked libmeos (the extended types cbuffer/pose/tcbuffer/ + * tpose/trgeo, pending the extended-type C-API) cannot get a sample, so their + * operators report NOSYNTH — a reason-marked, nm -D-provable gap, not a binding + * defect. + * + * args: (allClassesCSV = every + * MeosOps* facade class, used to resolve the `*_in` constructors). + */ +public class PerMethodCallability { + // name-segment -> (facade constructor, canonical literal) + static final String[][] TOK = { + {"tgeompoint","tgeompoint_in","SRID=4326;POINT(1 2)@2000-01-01"}, + {"tgeogpoint","tgeogpoint_in","SRID=4326;POINT(1 2)@2000-01-01"}, + {"tgeometry","tgeometry_in","SRID=4326;POINT(1 2)@2000-01-01"}, + {"tgeography","tgeography_in","SRID=4326;POINT(1 2)@2000-01-01"}, + {"tcbuffer","tcbuffer_in","Cbuffer(Point(1 1),2)@2000-01-01"}, + {"tnpoint","tnpoint_in","NPoint(1,0.5)@2000-01-01"}, + {"tpose","tpose_in","Pose(Point(1 1),0.5)@2000-01-01"}, + {"tgeo","tgeompoint_in","SRID=4326;POINT(1 2)@2000-01-01"}, + {"tspatial","tgeompoint_in","SRID=4326;POINT(1 2)@2000-01-01"}, + {"tnumber","tfloat_in","1.5@2000-01-01"}, + {"temporal","tfloat_in","1.5@2000-01-01"}, + {"tpoint","tgeompoint_in","SRID=4326;POINT(1 2)@2000-01-01"}, + {"tfloat","tfloat_in","1.5@2000-01-01"}, + {"tint","tint_in","5@2000-01-01"}, + {"tbool","tbool_in","true@2000-01-01"}, + {"ttext","ttext_in","\"hi\"@2000-01-01"}, + {"cbuffer","cbuffer_in","Cbuffer(Point(1 1),2)"}, + {"npointset","npointset_in","{NPoint(1,0.5), NPoint(2,0.3)}"}, + {"npoint","npoint_in","NPoint(1,0.5)"}, + {"nsegment","nsegment_in","NSegment(1,0.2,0.8)"}, + {"pose","pose_in","Pose(Point(1 1),0.5)"}, + {"geometry","geom_in","SRID=4326;POINT(1 2)"}, + {"geography","geog_in","SRID=4326;POINT(1 2)"}, + {"geog","geog_in","SRID=4326;POINT(1 2)"}, + {"geo","geom_in","SRID=4326;POINT(1 2)"}, + {"geom","geom_in","SRID=4326;POINT(1 2)"}, + {"point","geom_in","SRID=4326;POINT(1 2)"}, + {"stbox","stbox_in","STBOX XT(((1,1),(2,2)),[2000-01-01,2000-01-02])"}, + {"tbox","tbox_in","TBOX XT([1,2],[2000-01-01,2000-01-02])"}, + {"intspanset","intspanset_in","{[1, 3), [5, 7)}"}, + {"floatspanset","floatspanset_in","{[1.5, 2.5)}"}, + {"tstzspanset","tstzspanset_in","{[2000-01-01, 2000-01-02)}"}, + {"datespanset","datespanset_in","{[2000-01-01, 2000-01-03)}"}, + {"bigintspanset","bigintspanset_in","{[1, 3), [5, 7)}"}, + {"spanset","floatspanset_in","{[1.5, 2.5)}"}, + {"numspan","floatspan_in","[1.5, 2.5)"}, + {"intspan","intspan_in","[1, 5)"}, + {"floatspan","floatspan_in","[1.5, 2.5)"}, + {"tstzspan","tstzspan_in","[2000-01-01, 2000-01-02)"}, + {"datespan","datespan_in","[2000-01-01, 2000-01-05)"}, + {"bigintspan","bigintspan_in","[1, 5)"}, + {"span","floatspan_in","[1.5, 2.5)"}, + {"intset","intset_in","{1, 2, 3}"}, + {"floatset","floatset_in","{1.5, 2.5}"}, + {"tstzset","tstzset_in","{2000-01-01, 2000-01-02}"}, + {"dateset","dateset_in","{2000-01-01, 2000-01-02}"}, + {"bigintset","bigintset_in","{1, 2, 3}"}, + {"textset","textset_in","{\"a\", \"b\"}"}, + {"geomset","geomset_in","{SRID=4326;POINT(1 2)}"}, + {"set","floatset_in","{1.5, 2.5}"}, + {"text","text_in","hello"}, + {"interval","pg_interval_in","1 day"}, + // naming-variant tokens: typed TBox prefixes all share tbox_in; the geo + // set superclass + plain geo-set prefix share geomset_in; line is a geom. + {"tboxfloat","tbox_in","TBOX XT([1, 2], [2000-01-01, 2000-01-02])"}, + {"tboxint","tbox_in","TBOXINT X([1, 2])"}, + {"tfloatbox","tbox_in","TBOX XT([1, 2], [2000-01-01, 2000-01-02])"}, + {"tintbox","tbox_in","TBOXINT X([1, 2])"}, + {"geoset","geomset_in","{POINT(1 1), POINT(2 2)}"}, + {"spatialset","geomset_in","{POINT(1 1), POINT(2 2)}"}, + {"line","geom_in","SRID=4326;LINESTRING(0 0, 1 1, 2 2)"}, + // typed-instant constructors `inst_make(value, TimestampTz)` — the + // value-type token is the whole `inst` word (no underscore split). + {"tpointinst","geom_in","SRID=4326;POINT(1 2)"}, + {"tgeoinst","geom_in","SRID=4326;POINT(1 2)"}, + {"tnpointinst","npoint_in","NPoint(1,0.5)"}, + {"ttextinst","text_in","hello"}, + }; + static Map index = new HashMap<>(); + static Map samples = new HashMap<>(); + // extended-type sets with no single-string ctor: {token, element ctor, make fn} + static final String[][] SETMAKE = { + {"cbufferset","cbuffer_in","cbufferset_make"}, + {"poseset","pose_in","poseset_make"}, + {"npointset","npoint_in","npointset_make"}, + }; + static Pointer intervalSample; // for date/timestamptz funcs whose Interval arg is not in the name + // functions whose trailing Pointer is an OUT param (the result is written to it) + static final Set OUTPARAM = new HashSet<>(Arrays.asList( + "lwproj_lookup","spheroid_init_from_srid","tempsubtype_from_string")); + + public static void main(String[] args) throws Exception { + String pkg=args[0], target=args[1], method=args[2], allcsv=args[3]; + Class.forName("functions.GeneratedFunctions").getMethod("meos_initialize").invoke(null); + for (String cn: allcsv.split(",")) { + try { for (Method m: Class.forName(pkg+"."+cn).getDeclaredMethods()) + if (Modifier.isStatic(m.getModifiers()) && Modifier.isPublic(m.getModifiers())) + index.putIfAbsent(m.getName(), m); } catch (Throwable t) {} + } + // build only the samples whose token appears in the method name + Set need=new HashSet<>(Arrays.asList(method.split("_"))); + for (String[] tk: TOK) { + if (!need.contains(tk[0]) || samples.containsKey(tk[0])) continue; + Method ctor=index.get(tk[1]); if (ctor==null) continue; + // Some constructors take more than the WKT/literal string — notably + // geom_in(String,int) / geog_in(String,int) where the trailing int is + // the PostGIS typmod (-1 = unconstrained). Invoking with only the + // literal silently fails (wrong arg count), which previously left the + // whole geometry/geography family without a sample. Build the args to + // match the ctor's arity: literal first, synthesized primitives after. + try { + Object p=ctor.invoke(null, ctorArgs(ctor, tk[2])); + if (p instanceof Pointer) samples.put(tk[0],(Pointer)p); + } catch (Throwable t) {} + } + // Set samples for the extended-type sets have no single-string `*_in` + // (their WKT has comma-bearing elements). Build them the canonical way: + // a real element array passed to `_make(T** values, int count)`. + for (String[] sm : SETMAKE) { + if (!need.contains(sm[0]) || samples.containsKey(sm[0])) continue; + Pointer arr=buildArray(sm[1], 1); Method mk=index.get(sm[2]); + if (arr!=null && mk!=null) try { + Object s=mk.invoke(null, arr, 1); // single-element set (no dup-rejection) + if (s instanceof Pointer) samples.put(sm[0],(Pointer)s); + } catch (Throwable t) {} + } + // trgeometry has no single-string ctor; build it component-wise via + // trgeometryinst_make(GSERIALIZED *geom, Pose *pose, TimestampTz t). + if (need.contains("trgeometry") && !samples.containsKey("trgeometry")) { + Method gi=index.get("geom_in"), mk=index.get("trgeometryinst_make"); + Pointer pose=buildSample("pose_in"); + // a trgeometry is a rigid AREAL geometry — needs a polygon, not a point + Pointer geom = (gi!=null) ? safe(gi, ctorArgs(gi, "Polygon((1 1,2 2,3 1,1 1))")) : null; + if (geom!=null && pose!=null && mk!=null) try { + Object s=mk.invoke(null, geom, pose, OffsetDateTime.parse("2000-01-01T00:00:00Z")); + if (s instanceof Pointer) samples.put("trgeometry",(Pointer)s); + } catch (Throwable t) {} + } + intervalSample = buildSample("pg_interval_in"); // "1 day" — for date/timestamptz Interval args + Method m=index.get(method); + if (m==null || !m.getDeclaringClass().getSimpleName().equals(target)) { + try { for (Method x: Class.forName(pkg+"."+target).getDeclaredMethods()) + if (x.getName().equals(method) && Modifier.isStatic(x.getModifiers())) { m=x; break; } } catch (Throwable t) {} + } + if (m==null) { System.out.println("NOMETHOD"); return; } + Object[] a=synth(m.getName(), m.getParameterTypes()); + if (a==null) { System.out.println("NOSYNTH"); return; } + try { m.invoke(null,a); System.out.println("OK"); } + catch (InvocationTargetException e) { + Throwable c=e.getCause(); String cn=c==null?"":c.getClass().getName(); + if (cn.contains("UnsatisfiedLink")||cn.contains("NoSuchMethod")||cn.contains("IllegalArgument")) System.out.println("BINDFAIL"); + else System.out.println("MEOSERR"); // reached MEOS -> callable + } catch (Throwable t) { System.out.println("BINDFAIL"); } + } + + // assign each Pointer arg the next name-token sample (in appearance order); + // primitives get canonical samples; unsynthesizable Pointer -> null (NOSYNTH) + static Object[] synth(String name, Class[] pt) { + // Array constructors `set_make(T** vals, int n)` / `arr_round(T** arr, + // int n, int maxdd)` take a real C array-of-pointers + a count. Build a + // 2-element T** of the element type via native memory (the element ctor is + // derived from the name) and pass it with count=2. + String elemCtor = arrayElemCtor(name); + if (elemCtor != null && pt.length>=2 && pt[0]==Pointer.class && pt[1]==int.class) { + Pointer arr=buildArray(elemCtor, 1); + if (arr!=null) { + Object[] a=new Object[pt.length]; + a[0]=arr; a[1]=1; // single-element array (count must match) + for (int i=2;i ptrSamples=new ArrayList<>(); + for (String seg: name.split("_")) { + Pointer s=samples.get(seg); + if (s!=null) ptrSamples.add(s); + } + // Aggregate transition/combine/final functions take an aggregate STATE + // pointer that has no `*_in` constructor (and so no name-token sample); + // NULL is the documented MEOS empty-state bootstrap (every transfn does + // `if (state == NULL) state = `), so a token-less Pointer in these + // is a legitimate, non-degenerate input — not a synthesis failure. + boolean agg = name.endsWith("transfn") || name.endsWith("combinefn") + || name.endsWith("finalfn"); + int pi=0; Object[] a=new Object[pt.length]; + for (int i=0;i t=pt[i]; + if (t==Pointer.class) { + if (pi skip + } + else if (t==int.class) a[i]=1; + else if (t==long.class) a[i]=1L; + else if (t==double.class) a[i]=1.0; + else if (t==float.class) a[i]=1.0f; + else if (t==boolean.class) a[i]=true; + else if (t==byte.class) a[i]=(byte)1; // WKB-variant / flag byte params + else if (t==short.class) a[i]=(short)1; + else if (t==String.class) a[i]="1"; + else if (t==OffsetDateTime.class) a[i]=OffsetDateTime.parse("2000-01-01T00:00:00Z"); + else if (t==LocalDateTime.class) a[i]=LocalDateTime.parse("2000-01-01T00:00:00"); + else return null; // e.g. a callback fn-pointer type + } + return a; + } + + // Build constructor args matching the ctor's arity: the WKT/literal goes + // first; trailing primitives get canonical defaults (int = -1, the PostGIS + // typmod "unconstrained" used by geom_in/geog_in). + static Object[] ctorArgs(Method ctor, String literal) { + Class[] pt=ctor.getParameterTypes(); + Object[] a=new Object[pt.length]; + for (int i=0;i t=pt[i]; + if (t==String.class) a[i]=literal; + else if (t==int.class) a[i]=-1; + else if (t==long.class) a[i]=-1L; + else if (t==double.class) a[i]=0.0; + else if (t==float.class) a[i]=0.0f; + else if (t==boolean.class) a[i]=false; + else if (t==byte.class) a[i]=(byte)0; + else if (t==short.class) a[i]=(short)0; + else a[i]=null; + } + return a; + } + + // Build a native T** array of `n` copies of a sample built from `ctorName`. + static Pointer buildArray(String ctorName, int n) { + Pointer elem=buildSample(ctorName); + if (elem==null) return null; + Runtime rt=Runtime.getSystemRuntime(); + Pointer arr=Memory.allocateDirect(rt, (long)n*rt.addressSize()); + for (int i=0;i t) { + if (t==int.class) return 1; if (t==long.class) return 1L; if (t==double.class) return 1.0; + if (t==float.class) return 1.0f; if (t==boolean.class) return true; return null; // Pointer -> null (e.g. optional Interval maxt) + } + + static Pointer outBuffer() { return Memory.allocateDirect(Runtime.getSystemRuntime(), 64); } +} diff --git a/tools/streaming_parity/callability/run_callability.sh b/tools/streaming_parity/callability/run_callability.sh new file mode 100755 index 0000000000..8c8d2ce009 --- /dev/null +++ b/tools/streaming_parity/callability/run_callability.sh @@ -0,0 +1,121 @@ +#!/usr/bin/env bash +# Callability test driver for the Flink/Kafka MEOS facade (shared MeosOps* surface). +# Compiles the facade against JMEOS, then runs FacadeCallability ONE class per JVM +# (crash isolation) with libmeos on the JNR-FFI path, aggregating the callable set. +# +# Usage: run_callability.sh [out.txt] +# e.g. run_callability.sh \ +# flink-processor/src/main/java/org/mobilitydb/flink/meos \ +# org.mobilitydb.flink.meos /path/JMEOS-fat.jar /usr/local/lib callable.txt +set -euo pipefail +FAC="$1"; PKG="$2"; JAR="$3"; LIBDIR="$4"; OUT="${5:-callable.txt}" +HERE="$(cd "$(dirname "$0")" && pwd)" +# JMEOS loads libmeos via jnr `LibraryLoader.search(/src).load("meos")`, +# which resolves through the OS loader — it does NOT honour +# -Djnr.ffi.library.path. So the lib actually measured is whatever the OS finds +# (e.g. a stale /usr/local/lib/libmeos.so), NOT $LIBDIR, unless we put $LIBDIR on +# LD_LIBRARY_PATH. Pin it so the harness measures the build under test. +export LD_LIBRARY_PATH="$LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" +WORK="$(mktemp -d)" +javac -cp "$JAR" -d "$WORK" "$FAC"/*.java +javac -cp "$JAR:$WORK" -d "$WORK" "$HERE/FacadeCallability.java" +: > "$OUT" +for cls in $(ls "$WORK"/$(echo "$PKG" | tr . /)/MeosOps*.class | xargs -n1 basename | sed 's/\.class//' | grep -v '\$'); do + timeout 30 java -cp "$WORK:$JAR" -Djnr.ffi.library.path="$LIBDIR" \ + FacadeCallability "$PKG" "$cls" "$OUT" >/dev/null 2>&1 || true # abort = reached MEOS +done +sort -u "$OUT" -o "$OUT" +echo "CALLABLE: $(wc -l < "$OUT")" + +# --- Per-method variant (rigorous; the DEFINITIVE run) --------------------- +# FacadeCallability tests a whole class per JVM (a mid-class abort loses the +# rest, so it is only a fast floor). PerMethodCallability tests ONE +# (class,method) per JVM with TYPE-AWARE input synthesis (the "connectors": +# each Pointer arg built from a per-type sample inferred from the function-name +# tokens — see PerMethodCallability.java) and classifies by outcome: +# reached native MEOS = CALLABLE — stdout OK | MEOSERR, native exit(1) on a +# MEOS semantic error (rc!=0 with no Java stack trace), or a signal (rc>128); +# stdout BINDFAIL (UnsatisfiedLink/NoSuchMethod/marshalling) = NOT callable; +# stdout NOMETHOD/NOSYNTH = untestable here (args not literal-synthesizable). +# This run lifted confirmed Flink/Kafka callability to 1472 of 1949 streamable +# (75.5%). The remainder splits into (a) extended-type ops whose ctor is ABSENT +# from the linked libmeos (cbuffer/pose/tcbuffer/tpose/trgeo, ~302) — a reason- +# marked, nm -D-provable gap pending the extended-type C-API, NOT a binding +# defect; and (b) ~173 present-in-libmeos ops whose args are arrays / aggregate +# state / type-enums (not literal-synthesizable), correctness inherited from the +# MEOS PostgreSQL suite. Three are declared-not-built defects (tfloat_avg_value, +# tnumber_trend, geog_from_binary). +run_per_method() { # [out.txt] + local FAC="$1" PKG="$2" JAR="$3" LIBDIR="$4" OUT="${5:-callable.txt}" + local HERE WORK ALL ERR; HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + export LD_LIBRARY_PATH="$LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" # pin lib under test (see top note) + WORK="$(mktemp -d)"; ERR="$(mktemp)" + javac -cp "$JAR" -d "$WORK" "$FAC"/*.java + javac -cp "$JAR:$WORK" -d "$WORK" "$HERE/PerMethodCallability.java" + ALL=$(ls "$WORK"/$(echo "$PKG" | tr . /)/MeosOps*.class | xargs -n1 basename \ + | sed 's/\.class//' | grep -vE '\$|Runtime' | tr '\n' ',' | sed 's/,$//') + : > "$OUT"; : > "$OUT.not"; : > "$OUT.skip" + for cls in $(echo "$ALL" | tr ',' ' '); do + for m in $(javap -p -classpath "$WORK:$JAR" "$PKG.$cls" 2>/dev/null \ + | grep -E "public static" \ + | sed -E 's/.*\b([a-z][a-zA-Z0-9_]*)\(.*/\1/' | grep -E '^[a-z]'); do + out=$(timeout 25 java -cp "$WORK:$JAR" -Djnr.ffi.library.path="$LIBDIR" \ + PerMethodCallability "$PKG" "$cls" "$m" "$ALL" 2>"$ERR"); rc=$? + v=$(printf '%s\n' "$out" | grep -E '^(OK|MEOSERR|BINDFAIL|NOMETHOD|NOSYNTH)$' | tail -1) + jt=$(grep -cE '^[[:space:]]+at [A-Za-z]' "$ERR") + if [ "$v" = OK ] || [ "$v" = MEOSERR ] || [ "$rc" -gt 128 ]; then echo "$m" >> "$OUT" + elif [ "$v" = BINDFAIL ]; then echo "$m" >> "$OUT.not" + elif [ "$v" = NOMETHOD ] || [ "$v" = NOSYNTH ]; then echo "$m" >> "$OUT.skip" + elif [ "$rc" -ne 0 ] && [ "$jt" -eq 0 ]; then echo "$m" >> "$OUT" # native MEOS exit + else echo "$m" >> "$OUT.skip"; fi + done + done + sort -u "$OUT" -o "$OUT"; sort -u "$OUT.not" -o "$OUT.not"; sort -u "$OUT.skip" -o "$OUT.skip" + echo "CALLABLE=$(wc -l < "$OUT") BINDFAIL=$(wc -l < "$OUT.not") SKIP=$(wc -l < "$OUT.skip")" +} + +# --- Parallel per-method variant (same classification, N JVMs at once) -------- +# One JVM per (class,method) is correct but ~30 min serially over 2,097 methods. +# Each JVM is independent (crash isolation already per-method), so they fan out +# cleanly. NPROC defaults to 6. Produces identical $OUT/$OUT.not/$OUT.skip. +# Usage: run_per_method_par [out.txt] [nproc] +run_per_method_par() { + local FAC="$1" PKG="$2" JAR="$3" LIBDIR="$4" OUT="${5:-callable.txt}" NP="${6:-6}" + local HERE WORK ALL; HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + export LD_LIBRARY_PATH="$LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" # pin lib under test + WORK="$(mktemp -d)" + javac -cp "$JAR" -d "$WORK" "$FAC"/*.java + javac -cp "$JAR:$WORK" -d "$WORK" "$HERE/PerMethodCallability.java" + ALL=$(ls "$WORK"/$(echo "$PKG" | tr . /)/MeosOps*.class | xargs -n1 basename \ + | sed 's/\.class//' | grep -vE '\$|Runtime' | tr '\n' ',' | sed 's/,$//') + # one (class method) pair per line + local WL="$WORK/worklist"; : > "$WL" + local cls m + for cls in $(echo "$ALL" | tr ',' ' '); do + for m in $(javap -p -classpath "$WORK:$JAR" "$PKG.$cls" 2>/dev/null \ + | grep -E "public static" \ + | sed -E 's/.*\b([a-z][a-zA-Z0-9_]*)\(.*/\1/' | grep -E '^[a-z]'); do + echo "$cls $m" >> "$WL" + done + done + # per-pair classifier emitted to a temp script (xargs can't see bash functions) + local PR="$WORK/prun.sh" + cat > "$PR" </tmp/e.\$\$); rc=\$? +v=\$(printf '%s\n' "\$out" | grep -E '^(OK|MEOSERR|BINDFAIL|NOMETHOD|NOSYNTH)\$' | tail -1) +jt=\$(grep -cE '^[[:space:]]+at [A-Za-z]' /tmp/e.\$\$); rm -f /tmp/e.\$\$ +if [ "\$v" = OK ] || [ "\$v" = MEOSERR ] || [ "\$rc" -gt 128 ]; then echo "CALLABLE \$2" +elif [ "\$v" = BINDFAIL ]; then echo "BINDFAIL \$2" +elif [ "\$v" = NOMETHOD ] || [ "\$v" = NOSYNTH ]; then echo "SKIP \$2" +elif [ "\$rc" -ne 0 ] && [ "\$jt" -eq 0 ]; then echo "CALLABLE \$2" +else echo "SKIP \$2"; fi +EOF + chmod +x "$PR" + local RES="$WORK/res"; xargs -P "$NP" -L 1 "$PR" < "$WL" > "$RES" + awk '$1=="CALLABLE"{print $2}' "$RES" | sort -u > "$OUT" + awk '$1=="BINDFAIL"{print $2}' "$RES" | sort -u > "$OUT.not" + awk '$1=="SKIP"{print $2}' "$RES" | sort -u > "$OUT.skip" + echo "CALLABLE=$(wc -l < "$OUT") BINDFAIL=$(wc -l < "$OUT.not") SKIP=$(wc -l < "$OUT.skip")" +} +# run_per_method_par "$FAC" "$PKG" "$JAR" "$LIBDIR" callable.txt 6 diff --git a/tools/streaming_parity/ci_gate.py b/tools/streaming_parity/ci_gate.py new file mode 100644 index 0000000000..af50469e95 --- /dev/null +++ b/tools/streaming_parity/ci_gate.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +"""Streaming-parity CI gate (Path-to-100 step 6). + +A fast, self-contained guard that operationalizes the measured-not-guessed +discipline. It does NOT re-run the multi-minute callability harness; it checks +the committed feed against two invariants so a regression or an over-claim +fails CI: + + 1. NO L3 REGRESSION — confirmed-callable (streamable ∩ proven) must not drop + below the recorded floor. + 2. NO OVER-CLAIM — the assessment doc may not state "100%" while the gap list + is non-empty (the exact failure mode this whole methodology was built to + prevent: "2,097 wired = 100%" measured facade size, not callability). + 3. DOC CONSISTENCY — the L3 count the doc states must match the feed. + +Inputs are committed alongside it (feeds/streamable.txt + feeds/*.feed.tsv), so +the gate runs in CI with only Python — no JMEOS jar, no libmeos, no toolchain. + +Usage: + ci_gate.py [--feed feeds/flink-kafka.feed.tsv] [--streamable feeds/streamable.txt] + [--doc doc/methodology/streaming_parity_assessment.md] [--floor 1794] +Exit non-zero on any violation. +""" +from __future__ import annotations +import argparse +import os +import re +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def load_streamable(path): + return {ln.strip() for ln in open(path) if ln.strip()} + + +def load_feed(path): + proven, wired = set(), set() + for ln in open(path): + p = ln.rstrip("\n").split("\t") + if len(p) >= 2 and p[0]: + (proven if p[1].strip().lower() == "proven" else wired).add(p[0]) + return proven, wired + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--feed", default=os.path.join(HERE, "feeds/flink-kafka.feed.tsv")) + ap.add_argument("--streamable", default=os.path.join(HERE, "feeds/streamable.txt")) + ap.add_argument("--doc", default=os.path.join(HERE, "..", "..", "doc/methodology/streaming_parity_assessment.md")) + ap.add_argument("--floor", type=int, default=1945, + help="minimum confirmed-callable; CI fails below this") + a = ap.parse_args() + + streamable = load_streamable(a.streamable) + proven, wired = load_feed(a.feed) + n_str = len(streamable) + callable_n = len(streamable & proven) + wired_only = len(streamable & wired - proven) + gap = n_str - callable_n - wired_only + pct = 100.0 * callable_n / n_str if n_str else 0.0 + + print(f"streamable={n_str} L3 callable={callable_n} ({pct:.1f}%) " + f"wired-only={wired_only} gap={gap} floor={a.floor}") + + violations = [] + # 1. regression floor + if callable_n < a.floor: + violations.append(f"L3 REGRESSION: {callable_n} < floor {a.floor}") + + # 2/3. doc cross-checks (best-effort; only if the doc is present) + doc = os.path.exists(a.doc) and open(a.doc).read() or "" + if doc: + # 2. no-overclaim: a headline / platform / callability line may not state a + # percentage above what the feed supports while a gap remains. Scoped to + # those lines (incl. the per-platform result rows, which name + # Flink/Kafka/Nebula but not the word "callable") so the "Path to 100%" + # heading and "'100%' claim" methodology references don't false-positive. + if (wired_only + gap) > 0: + for ln in doc.splitlines(): + if not re.search(r'callable|flink|kafka|nebula|\bl3\b', ln, re.I): + continue + for pc in re.findall(r'(\d{1,3}(?:\.\d)?)\s*%', ln): + if float(pc) > pct + 0.1: + violations.append( + f"OVER-CLAIM: a callability line states {pc}% > measured " + f"{pct:.1f}% while {wired_only + gap} streamable functions " + f"are not yet confirmed callable: '{ln.strip()[:70]}'") + break + else: + continue + break + # 3. consistency: the doc must state the measured count + if str(callable_n) not in doc.replace(",", ""): + violations.append( + f"DOC DRIFT: feed measures {callable_n} confirmed callable, " + f"but the assessment doc does not state it") + + if violations: + print("\nFAIL — streaming-parity gate:") + for v in violations: + print(f" ✗ {v}") + sys.exit(1) + print("OK — no regression, no over-claim, doc consistent.") + + +if __name__ == "__main__": + main() diff --git a/tools/streaming_parity/feeds/README.md b/tools/streaming_parity/feeds/README.md new file mode 100644 index 0000000000..fb6dcfb70c --- /dev/null +++ b/tools/streaming_parity/feeds/README.md @@ -0,0 +1,51 @@ +# Measured feeds — the reproducible artifact behind the parity numbers + +A *feed* is `{proven|wired}`, the input to +`streaming_parity.py`. Committing the feed makes the assessment table +reproducible in seconds without re-running the multi-minute callability harness. + +## `flink-kafka.feed.tsv` + +Flink and Kafka share one generated JNR-FFI facade (`MeosOps*.java`, 2,097 +`public static` methods), so a single feed covers both. Measured against the +**`accumulate/parity-1.4` libmeos** (extended-type C-API present), with +`LD_LIBRARY_PATH` pinned to that build. + +- `proven` = the per-method callability harness invoked it on real libmeos + without a binding failure (2142 facade methods). +- `wired` = facade method exists but not confirmed callable (24). + +> **Note on the 65 `trgeometry_*` entries:** these were measured against **JMEOS +> PR #19**'s renamed `GeneratedFunctions` (the facade is a thin pass-through, so +> `GeneratedFunctions.trgeometry_round` == what the facade method runs). +> Regenerating the MobilityFlink/Kafka facade so it *emits* the `trgeometry_*` +> names (it currently still emits the old `trgeo_*`) is the pending mechanical +> step to make the shipped jar match this feed. + +Reproduce the table (instant): + +```sh +python3 ../streaming_parity.py \ + --catalog \ + --platform Flink/Kafka --feed flink-kafka.feed.tsv +# => L3 CALLABLE 1,945 / 1,945 = 100.0% +``` + +(The catalog is the streaming-relevance baseline — the per-function tier map, +shared across platforms; see `../../streaming_parity.py` header.) + +Regenerate the feed from scratch (binds every method on real libmeos, ~minutes +with the parallel runner): + +```sh +source ../callability/run_callability.sh +run_per_method_par \ + /flink-processor/src/main/java/org/mobilitydb/flink/meos \ + org.mobilitydb.flink.meos callable.txt 6 +python3 ../adapters/jvm_facade.py --facade-dir <…/meos> --passing callable.txt > flink-kafka.feed.tsv +``` + +**Pin the libmeos.** JMEOS resolves the library through the OS loader and +ignores `-Djnr.ffi.library.path`; `run_callability.sh` exports +`LD_LIBRARY_PATH=` so the measurement reflects the build +under test, not a stale system `/usr/local/lib/libmeos.so`. diff --git a/tools/streaming_parity/feeds/flink-kafka.feed.tsv b/tools/streaming_parity/feeds/flink-kafka.feed.tsv new file mode 100644 index 0000000000..03da656b50 --- /dev/null +++ b/tools/streaming_parity/feeds/flink-kafka.feed.tsv @@ -0,0 +1,2166 @@ +above_stbox_stbox proven +above_stbox_tspatial proven +above_tspatial_stbox proven +above_tspatial_tspatial proven +acontains_cbuffer_tcbuffer proven +acontains_geo_tcbuffer proven +acontains_geo_tgeo proven +acontains_tcbuffer_cbuffer proven +acontains_tcbuffer_geo proven +acontains_tgeo_geo proven +acontains_tgeo_tgeo proven +acovers_cbuffer_tcbuffer proven +acovers_geo_tcbuffer proven +acovers_tcbuffer_cbuffer proven +acovers_tcbuffer_geo proven +add_date_int proven +add_float_tfloat proven +add_int_tint proven +add_interval_interval proven +add_tfloat_float proven +add_timestamptz_interval proven +add_tint_int proven +add_tnumber_tnumber proven +adisjoint_tcbuffer_cbuffer proven +adisjoint_tcbuffer_geo proven +adisjoint_tcbuffer_tcbuffer proven +adisjoint_tgeo_geo proven +adisjoint_tgeo_tgeo proven +adjacent_numspan_tnumber proven +adjacent_span_bigint proven +adjacent_span_date proven +adjacent_span_float proven +adjacent_span_int proven +adjacent_span_span proven +adjacent_span_spanset proven +adjacent_span_timestamptz proven +adjacent_spanset_bigint proven +adjacent_spanset_date proven +adjacent_spanset_float proven +adjacent_spanset_int proven +adjacent_spanset_span proven +adjacent_spanset_spanset proven +adjacent_spanset_timestamptz proven +adjacent_stbox_stbox proven +adjacent_stbox_tspatial proven +adjacent_tbox_tbox proven +adjacent_tbox_tnumber proven +adjacent_temporal_temporal proven +adjacent_temporal_tstzspan proven +adjacent_tnumber_numspan proven +adjacent_tnumber_tbox proven +adjacent_tnumber_tnumber proven +adjacent_tspatial_stbox proven +adjacent_tspatial_tspatial proven +adjacent_tstzspan_temporal proven +adwithin_tcbuffer_cbuffer proven +adwithin_tcbuffer_geo proven +adwithin_tcbuffer_tcbuffer proven +adwithin_tgeo_geo proven +adwithin_tgeo_tgeo proven +after_date_set proven +after_date_span proven +after_date_spanset proven +after_set_date proven +after_set_timestamptz proven +after_span_date proven +after_span_timestamptz proven +after_spanset_date proven +after_spanset_timestamptz proven +after_stbox_stbox proven +after_stbox_tspatial proven +after_tbox_tbox proven +after_tbox_tnumber proven +after_temporal_temporal proven +after_temporal_tstzspan proven +after_timestamptz_set proven +after_timestamptz_span proven +after_timestamptz_spanset proven +after_tnumber_tbox proven +after_tnumber_tnumber proven +after_tspatial_stbox proven +after_tspatial_tspatial proven +after_tstzspan_temporal proven +aintersects_tcbuffer_cbuffer proven +aintersects_tcbuffer_geo proven +aintersects_tcbuffer_tcbuffer proven +aintersects_tgeo_geo proven +aintersects_tgeo_tgeo proven +alphanum_basetype proven +alphanum_temptype proven +alphanumset_type proven +always_eq_bool_tbool proven +always_eq_cbuffer_tcbuffer proven +always_eq_float_tfloat proven +always_eq_geo_tgeo proven +always_eq_geo_trgeometry proven +always_eq_int_tint proven +always_eq_npoint_tnpoint proven +always_eq_pose_tpose proven +always_eq_tbool_bool proven +always_eq_tcbuffer_cbuffer proven +always_eq_tcbuffer_tcbuffer proven +always_eq_temporal_temporal proven +always_eq_text_ttext proven +always_eq_tfloat_float proven +always_eq_tgeo_geo proven +always_eq_tgeo_tgeo proven +always_eq_tint_int proven +always_eq_tnpoint_npoint proven +always_eq_tnpoint_tnpoint proven +always_eq_tpose_pose proven +always_eq_tpose_tpose proven +always_eq_trgeometry_geo proven +always_eq_trgeometry_trgeometry proven +always_eq_ttext_text proven +always_ge_float_tfloat proven +always_ge_int_tint proven +always_ge_temporal_temporal proven +always_ge_text_ttext proven +always_ge_tfloat_float proven +always_ge_tint_int proven +always_ge_ttext_text proven +always_gt_float_tfloat proven +always_gt_int_tint proven +always_gt_temporal_temporal proven +always_gt_text_ttext proven +always_gt_tfloat_float proven +always_gt_tint_int proven +always_gt_ttext_text proven +always_le_float_tfloat proven +always_le_int_tint proven +always_le_temporal_temporal proven +always_le_text_ttext proven +always_le_tfloat_float proven +always_le_tint_int proven +always_le_ttext_text proven +always_lt_float_tfloat proven +always_lt_int_tint proven +always_lt_temporal_temporal proven +always_lt_text_ttext proven +always_lt_tfloat_float proven +always_lt_tint_int proven +always_lt_ttext_text proven +always_ne_bool_tbool proven +always_ne_cbuffer_tcbuffer proven +always_ne_float_tfloat proven +always_ne_geo_tgeo proven +always_ne_geo_trgeometry proven +always_ne_int_tint proven +always_ne_npoint_tnpoint proven +always_ne_pose_tpose proven +always_ne_tbool_bool proven +always_ne_tcbuffer_cbuffer proven +always_ne_tcbuffer_tcbuffer proven +always_ne_temporal_temporal proven +always_ne_text_ttext proven +always_ne_tfloat_float proven +always_ne_tgeo_geo proven +always_ne_tgeo_tgeo proven +always_ne_tint_int proven +always_ne_tnpoint_npoint proven +always_ne_tnpoint_tnpoint proven +always_ne_tpose_pose proven +always_ne_tpose_tpose proven +always_ne_trgeometry_geo proven +always_ne_trgeometry_trgeometry proven +always_ne_ttext_text proven +atouches_tcbuffer_cbuffer proven +atouches_tcbuffer_geo proven +atouches_tcbuffer_tcbuffer proven +atouches_tgeo_geo proven +atouches_tgeo_tgeo proven +atouches_tpoint_geo proven +back_stbox_stbox proven +back_stbox_tspatial proven +back_tspatial_stbox proven +back_tspatial_tspatial proven +basetype_byvalue proven +basetype_varlength proven +bearing_point_point proven +before_date_set proven +before_date_span proven +before_date_spanset proven +before_set_date proven +before_set_timestamptz proven +before_span_date proven +before_span_timestamptz proven +before_spanset_date proven +before_spanset_timestamptz proven +before_stbox_stbox proven +before_stbox_tspatial proven +before_tbox_tbox proven +before_tbox_tnumber proven +before_temporal_temporal proven +before_temporal_tstzspan proven +before_timestamptz_set proven +before_timestamptz_span proven +before_timestamptz_spanset proven +before_tnumber_tbox proven +before_tnumber_tnumber proven +before_tspatial_stbox proven +before_tspatial_tspatial proven +before_tstzspan_temporal proven +below_stbox_stbox proven +below_stbox_tspatial proven +below_tspatial_stbox proven +below_tspatial_tspatial proven +bigint_extent_transfn proven +bigint_get_bin proven +bigint_to_set proven +bigint_to_span proven +bigint_to_spanset proven +bigint_union_transfn proven +bigintset_end_value proven +bigintset_in proven +bigintset_make proven +bigintset_out proven +bigintset_shift_scale proven +bigintset_start_value proven +bigintset_value_n proven +bigintset_values proven +bigintspan_bins proven +bigintspan_expand proven +bigintspan_in proven +bigintspan_lower proven +bigintspan_make proven +bigintspan_out proven +bigintspan_shift_scale proven +bigintspan_upper proven +bigintspan_width proven +bigintspanset_bins proven +bigintspanset_in proven +bigintspanset_lower proven +bigintspanset_out proven +bigintspanset_shift_scale proven +bigintspanset_upper proven +bigintspanset_width proven +bool_in proven +bool_out proven +box3d_make proven +box3d_out wired +box3d_to_stbox proven +cbuffer_as_ewkt proven +cbuffer_as_hexwkb proven +cbuffer_as_text proven +cbuffer_as_wkb proven +cbuffer_cmp proven +cbuffer_copy proven +cbuffer_eq proven +cbuffer_from_hexwkb proven +cbuffer_from_wkb proven +cbuffer_ge proven +cbuffer_gt proven +cbuffer_hash proven +cbuffer_hash_extended proven +cbuffer_in proven +cbuffer_le proven +cbuffer_lt proven +cbuffer_make proven +cbuffer_ne proven +cbuffer_nsame proven +cbuffer_out proven +cbuffer_point proven +cbuffer_radius proven +cbuffer_round proven +cbuffer_same proven +cbuffer_set_srid proven +cbuffer_srid proven +cbuffer_timestamptz_to_stbox proven +cbuffer_to_geom proven +cbuffer_to_set proven +cbuffer_to_stbox proven +cbuffer_transform proven +cbuffer_transform_pipeline proven +cbuffer_tstzspan_to_stbox proven +cbuffer_union_transfn proven +cbufferarr_round proven +cbufferarr_to_geom proven +cbufferset_end_value proven +cbufferset_in proven +cbufferset_make proven +cbufferset_out proven +cbufferset_start_value proven +cbufferset_value_n proven +cbufferset_values proven +contained_bigint_set proven +contained_bigint_span proven +contained_bigint_spanset proven +contained_cbuffer_set proven +contained_date_set proven +contained_date_span proven +contained_date_spanset proven +contained_float_set proven +contained_float_span proven +contained_float_spanset proven +contained_geo_set proven +contained_int_set proven +contained_int_span proven +contained_int_spanset proven +contained_npoint_set proven +contained_numspan_tnumber proven +contained_pose_set proven +contained_set_set proven +contained_span_span proven +contained_span_spanset proven +contained_spanset_span proven +contained_spanset_spanset proven +contained_stbox_stbox proven +contained_stbox_tspatial proven +contained_tbox_tbox proven +contained_tbox_tnumber proven +contained_temporal_temporal proven +contained_temporal_tstzspan proven +contained_text_set proven +contained_timestamptz_set proven +contained_timestamptz_span proven +contained_timestamptz_spanset proven +contained_tnumber_numspan proven +contained_tnumber_tbox proven +contained_tnumber_tnumber proven +contained_tspatial_stbox proven +contained_tspatial_tspatial proven +contained_tstzspan_temporal proven +contains_cbuffer_cbuffer proven +contains_numspan_tnumber proven +contains_set_bigint proven +contains_set_cbuffer proven +contains_set_date proven +contains_set_float proven +contains_set_geo proven +contains_set_int proven +contains_set_npoint proven +contains_set_pose proven +contains_set_set proven +contains_set_text proven +contains_set_timestamptz proven +contains_span_bigint proven +contains_span_date proven +contains_span_float proven +contains_span_int proven +contains_span_span proven +contains_span_spanset proven +contains_span_timestamptz proven +contains_spanset_bigint proven +contains_spanset_date proven +contains_spanset_float proven +contains_spanset_int proven +contains_spanset_span proven +contains_spanset_spanset proven +contains_spanset_timestamptz proven +contains_stbox_stbox proven +contains_stbox_tspatial proven +contains_tbox_tbox proven +contains_tbox_tnumber proven +contains_temporal_temporal proven +contains_temporal_tstzspan proven +contains_tnumber_numspan proven +contains_tnumber_tbox proven +contains_tnumber_tnumber proven +contains_tspatial_stbox proven +contains_tspatial_tspatial proven +contains_tstzspan_temporal proven +covers_cbuffer_cbuffer proven +cstring2text proven +date_extent_transfn proven +date_get_bin proven +date_to_set proven +date_to_span proven +date_to_spanset proven +date_to_timestamp proven +date_to_timestamptz proven +date_union_transfn proven +dateset_end_value proven +dateset_in proven +dateset_make proven +dateset_out proven +dateset_shift_scale proven +dateset_start_value proven +dateset_to_tstzset proven +dateset_value_n proven +dateset_values proven +datespan_bins proven +datespan_duration proven +datespan_in proven +datespan_lower proven +datespan_make proven +datespan_out proven +datespan_shift_scale proven +datespan_to_tstzspan proven +datespan_upper proven +datespanset_bins proven +datespanset_date_n proven +datespanset_dates proven +datespanset_duration proven +datespanset_end_date proven +datespanset_in proven +datespanset_num_dates proven +datespanset_out proven +datespanset_shift_scale proven +datespanset_start_date proven +datespanset_to_tstzspanset proven +disjoint_cbuffer_cbuffer proven +distance_bigintset_bigintset proven +distance_bigintspan_bigintspan proven +distance_bigintspanset_bigintspan proven +distance_bigintspanset_bigintspanset proven +distance_cbuffer_cbuffer proven +distance_cbuffer_geo proven +distance_cbuffer_stbox proven +distance_dateset_dateset proven +distance_datespan_datespan proven +distance_datespanset_datespan proven +distance_datespanset_datespanset proven +distance_floatset_floatset proven +distance_floatspan_floatspan proven +distance_floatspanset_floatspan proven +distance_floatspanset_floatspanset proven +distance_intset_intset proven +distance_intspan_intspan proven +distance_intspanset_intspan proven +distance_intspanset_intspanset proven +distance_pose_geo proven +distance_pose_pose proven +distance_pose_stbox proven +distance_set_bigint proven +distance_set_date proven +distance_set_float proven +distance_set_int proven +distance_set_timestamptz proven +distance_span_bigint proven +distance_span_date proven +distance_span_float proven +distance_span_int proven +distance_span_timestamptz proven +distance_spanset_bigint proven +distance_spanset_date proven +distance_spanset_float proven +distance_spanset_int proven +distance_spanset_timestamptz proven +distance_tstzset_tstzset proven +distance_tstzspan_tstzspan proven +distance_tstzspanset_tstzspan proven +distance_tstzspanset_tstzspanset proven +div_float_tfloat proven +div_int_tint proven +div_tfloat_float proven +div_tint_int proven +div_tnumber_tnumber proven +dwithin_cbuffer_cbuffer proven +econtains_cbuffer_tcbuffer proven +econtains_geo_tgeo proven +econtains_tcbuffer_cbuffer proven +econtains_tcbuffer_geo proven +econtains_tgeo_geo proven +econtains_tgeo_tgeo proven +ecovers_cbuffer_tcbuffer proven +ecovers_geo_tgeo proven +ecovers_tcbuffer_cbuffer proven +ecovers_tcbuffer_geo proven +ecovers_tcbuffer_tcbuffer proven +ecovers_tgeo_geo proven +ecovers_tgeo_tgeo proven +edisjoint_tcbuffer_cbuffer proven +edisjoint_tcbuffer_geo proven +edisjoint_tgeo_geo proven +edisjoint_tgeo_tgeo proven +edwithin_tcbuffer_cbuffer proven +edwithin_tcbuffer_geo proven +edwithin_tcbuffer_tcbuffer proven +edwithin_tgeo_geo proven +edwithin_tgeo_tgeo proven +eintersects_tcbuffer_cbuffer proven +eintersects_tcbuffer_geo proven +eintersects_tcbuffer_tcbuffer proven +eintersects_tgeo_geo proven +eintersects_tgeo_tgeo proven +ensure_geoset_type proven +ensure_numset_type proven +ensure_numspan_type proven +ensure_set_spantype proven +ensure_span_tbox_type proven +ensure_spatialset_type proven +ensure_tgeo_type proven +ensure_tgeo_type_all proven +ensure_tgeodetic_type proven +ensure_tgeometry_type proven +ensure_timespanset_type proven +ensure_tnumber_basetype proven +ensure_tnumber_tpoint_type proven +ensure_tnumber_type proven +ensure_tpoint_type proven +ensure_tspatial_type proven +etouches_tcbuffer_cbuffer proven +etouches_tcbuffer_geo proven +etouches_tcbuffer_tcbuffer proven +etouches_tgeo_geo proven +etouches_tgeo_tgeo proven +etouches_tpoint_geo proven +ever_eq_bool_tbool proven +ever_eq_cbuffer_tcbuffer proven +ever_eq_float_tfloat proven +ever_eq_geo_tgeo proven +ever_eq_geo_trgeometry proven +ever_eq_int_tint proven +ever_eq_npoint_tnpoint proven +ever_eq_pose_tpose proven +ever_eq_tbool_bool proven +ever_eq_tcbuffer_cbuffer proven +ever_eq_tcbuffer_tcbuffer proven +ever_eq_temporal_temporal proven +ever_eq_text_ttext proven +ever_eq_tfloat_float proven +ever_eq_tgeo_geo proven +ever_eq_tgeo_tgeo proven +ever_eq_tint_int proven +ever_eq_tnpoint_npoint proven +ever_eq_tnpoint_tnpoint proven +ever_eq_tpose_pose proven +ever_eq_tpose_tpose proven +ever_eq_trgeometry_geo proven +ever_eq_trgeometry_trgeometry proven +ever_eq_ttext_text proven +ever_ge_float_tfloat proven +ever_ge_int_tint proven +ever_ge_temporal_temporal proven +ever_ge_text_ttext proven +ever_ge_tfloat_float proven +ever_ge_tint_int proven +ever_ge_ttext_text proven +ever_gt_float_tfloat proven +ever_gt_int_tint proven +ever_gt_temporal_temporal proven +ever_gt_text_ttext proven +ever_gt_tfloat_float proven +ever_gt_tint_int proven +ever_gt_ttext_text proven +ever_le_float_tfloat proven +ever_le_int_tint proven +ever_le_temporal_temporal proven +ever_le_text_ttext proven +ever_le_tfloat_float proven +ever_le_tint_int proven +ever_le_ttext_text proven +ever_lt_float_tfloat proven +ever_lt_int_tint proven +ever_lt_temporal_temporal proven +ever_lt_text_ttext proven +ever_lt_tfloat_float proven +ever_lt_tint_int proven +ever_lt_ttext_text proven +ever_ne_bool_tbool proven +ever_ne_cbuffer_tcbuffer proven +ever_ne_float_tfloat proven +ever_ne_geo_tgeo proven +ever_ne_geo_trgeometry proven +ever_ne_int_tint proven +ever_ne_npoint_tnpoint proven +ever_ne_pose_tpose proven +ever_ne_tbool_bool proven +ever_ne_tcbuffer_cbuffer proven +ever_ne_tcbuffer_tcbuffer proven +ever_ne_temporal_temporal proven +ever_ne_text_ttext proven +ever_ne_tfloat_float proven +ever_ne_tgeo_geo proven +ever_ne_tgeo_tgeo proven +ever_ne_tint_int proven +ever_ne_tnpoint_npoint proven +ever_ne_tnpoint_tnpoint proven +ever_ne_tpose_pose proven +ever_ne_tpose_tpose proven +ever_ne_trgeometry_geo proven +ever_ne_trgeometry_trgeometry proven +ever_ne_ttext_text proven +float8_out proven +float_angular_difference proven +float_degrees proven +float_exp proven +float_extent_transfn proven +float_get_bin proven +float_ln proven +float_log10 proven +float_round proven +float_timestamptz_to_tbox proven +float_to_set proven +float_to_span proven +float_to_spanset proven +float_to_tbox proven +float_tstzspan_to_tbox proven +float_union_transfn proven +floatset_ceil proven +floatset_degrees proven +floatset_end_value proven +floatset_floor proven +floatset_in proven +floatset_make proven +floatset_out proven +floatset_radians proven +floatset_shift_scale proven +floatset_start_value proven +floatset_to_intset proven +floatset_value_n proven +floatset_values proven +floatspan_bins proven +floatspan_ceil proven +floatspan_degrees proven +floatspan_expand proven +floatspan_floor proven +floatspan_in proven +floatspan_lower proven +floatspan_make proven +floatspan_out proven +floatspan_radians proven +floatspan_round proven +floatspan_shift_scale proven +floatspan_to_intspan proven +floatspan_upper proven +floatspan_width proven +floatspanset_bins proven +floatspanset_ceil proven +floatspanset_degrees proven +floatspanset_floor proven +floatspanset_in proven +floatspanset_lower proven +floatspanset_out proven +floatspanset_radians proven +floatspanset_round proven +floatspanset_shift_scale proven +floatspanset_to_intspanset proven +floatspanset_upper proven +floatspanset_width proven +front_stbox_stbox proven +front_stbox_tspatial proven +front_tspatial_stbox proven +front_tspatial_tspatial proven +gbox_make proven +gbox_out wired +gbox_to_stbox proven +geo_as_ewkb wired +geo_as_ewkt proven +geo_as_geojson proven +geo_as_hexewkb wired +geo_as_text proven +geo_basetype proven +geo_cluster_dbscan proven +geo_cluster_intersecting proven +geo_cluster_kmeans proven +geo_cluster_within proven +geo_collect_garray proven +geo_copy proven +geo_equals proven +geo_from_ewkb proven +geo_from_geojson proven +geo_from_text proven +geo_geo_n proven +geo_is_empty proven +geo_is_unitary proven +geo_makeline_garray proven +geo_num_geos proven +geo_num_points proven +geo_out proven +geo_pointarr proven +geo_points proven +geo_reverse proven +geo_round proven +geo_same proven +geo_set_srid proven +geo_split_each_n_stboxes proven +geo_split_n_stboxes proven +geo_srid proven +geo_stboxes proven +geo_timestamptz_to_stbox proven +geo_to_set proven +geo_to_stbox proven +geo_tpose_to_trgeometry proven +geo_transform proven +geo_transform_pipeline proven +geo_tstzspan_to_stbox proven +geo_typename proven +geo_union_transfn proven +geog_area proven +geog_centroid proven +geog_distance proven +geog_dwithin proven +geog_from_binary wired +geog_from_hexewkb proven +geog_in proven +geog_intersects proven +geog_length proven +geog_perimeter proven +geog_to_geom proven +geogset_in proven +geom_array_union proven +geom_azimuth proven +geom_boundary proven +geom_buffer proven +geom_centroid proven +geom_contains proven +geom_convex_hull proven +geom_covers proven +geom_difference2d proven +geom_disjoint2d proven +geom_distance2d proven +geom_distance3d proven +geom_dwithin2d proven +geom_dwithin3d proven +geom_from_hexewkb proven +geom_in proven +geom_intersection2d proven +geom_intersection2d_coll proven +geom_intersects2d proven +geom_intersects3d proven +geom_length proven +geom_min_bounding_radius proven +geom_perimeter proven +geom_relate_pattern proven +geom_shortestline2d proven +geom_shortestline3d proven +geom_to_cbuffer proven +geom_to_geog proven +geom_to_nsegment proven +geom_touches proven +geom_unary_union proven +geomset_in proven +geoset_end_value proven +geoset_make proven +geoset_start_value proven +geoset_type proven +geoset_value_n proven +geoset_values proven +get_srid_ways proven +int32_cmp proven +int64_cmp proven +int_extent_transfn proven +int_get_bin proven +int_timestamptz_to_tbox proven +int_to_set proven +int_to_span proven +int_to_spanset proven +int_to_tbox proven +int_tstzspan_to_tbox proven +int_union_transfn proven +interptype_name proven +intersection_bigint_set proven +intersection_date_set proven +intersection_float_set proven +intersection_geo_set proven +intersection_int_set proven +intersection_set_bigint proven +intersection_set_cbuffer proven +intersection_set_date proven +intersection_set_float proven +intersection_set_geo proven +intersection_set_int proven +intersection_set_npoint proven +intersection_set_pose proven +intersection_set_set proven +intersection_set_text proven +intersection_set_timestamptz proven +intersection_span_bigint proven +intersection_span_date proven +intersection_span_float proven +intersection_span_int proven +intersection_span_span proven +intersection_span_spanset proven +intersection_span_timestamptz proven +intersection_spanset_bigint proven +intersection_spanset_date proven +intersection_spanset_float proven +intersection_spanset_int proven +intersection_spanset_span proven +intersection_spanset_spanset proven +intersection_spanset_timestamptz proven +intersection_stbox_stbox proven +intersection_tbox_tbox proven +intersection_text_set proven +intersection_timestamptz_set proven +intersects_cbuffer_cbuffer proven +interval_make proven +intset_end_value proven +intset_in proven +intset_make proven +intset_out proven +intset_shift_scale proven +intset_start_value proven +intset_to_floatset proven +intset_value_n proven +intset_values proven +intspan_bins proven +intspan_expand proven +intspan_in proven +intspan_lower proven +intspan_make proven +intspan_out proven +intspan_shift_scale proven +intspan_to_floatspan proven +intspan_upper proven +intspan_width proven +intspanset_bins proven +intspanset_in proven +intspanset_lower proven +intspanset_out proven +intspanset_shift_scale proven +intspanset_to_floatspanset proven +intspanset_upper proven +intspanset_width proven +left_bigint_set proven +left_bigint_span proven +left_bigint_spanset proven +left_float_set proven +left_float_span proven +left_float_spanset proven +left_int_set proven +left_int_span proven +left_int_spanset proven +left_numspan_tnumber proven +left_set_bigint proven +left_set_float proven +left_set_int proven +left_set_set proven +left_set_text proven +left_span_bigint proven +left_span_float proven +left_span_int proven +left_span_span proven +left_span_spanset proven +left_spanset_bigint proven +left_spanset_float proven +left_spanset_int proven +left_spanset_span proven +left_spanset_spanset proven +left_stbox_stbox proven +left_stbox_tspatial proven +left_tbox_tbox proven +left_tbox_tnumber proven +left_text_set proven +left_tnumber_numspan proven +left_tnumber_tbox proven +left_tnumber_tnumber proven +left_tspatial_stbox proven +left_tspatial_tspatial proven +line_numpoints proven +lwproj_lookup proven +meos_array_add wired +meos_array_count wired +meos_array_create proven +meos_array_destroy wired +meos_array_destroy_free wired +meos_array_get wired +meos_array_reset wired +meos_array_reset_free wired +meos_basetype wired +meos_errno proven +meos_errno_reset proven +meos_errno_restore proven +meos_errno_set proven +meos_error proven +meos_finalize proven +meos_finalize_projsrs proven +meos_finalize_timezone proven +meos_finalize_ways proven +meos_get_datestyle proven +meos_get_intervalstyle proven +meos_initialize proven +meos_initialize_error_handler wired +meos_initialize_timezone proven +meos_set_datestyle proven +meos_set_intervalstyle proven +meos_set_spatial_ref_sys_csv proven +meosoper_name proven +meostype_length proven +meostype_name proven +minus_bigint_set proven +minus_bigint_span proven +minus_bigint_spanset proven +minus_cbuffer_set proven +minus_date_date proven +minus_date_int proven +minus_date_set proven +minus_date_span proven +minus_date_spanset proven +minus_float_set proven +minus_float_span proven +minus_float_spanset proven +minus_geo_set proven +minus_int_set proven +minus_int_span proven +minus_int_spanset proven +minus_npoint_set proven +minus_pose_set proven +minus_set_bigint proven +minus_set_cbuffer proven +minus_set_date proven +minus_set_float proven +minus_set_geo proven +minus_set_int proven +minus_set_npoint proven +minus_set_pose proven +minus_set_set proven +minus_set_text proven +minus_set_timestamptz proven +minus_span_bigint proven +minus_span_date proven +minus_span_float proven +minus_span_int proven +minus_span_span proven +minus_span_spanset proven +minus_span_timestamptz proven +minus_spanset_bigint proven +minus_spanset_date proven +minus_spanset_float proven +minus_spanset_int proven +minus_spanset_span proven +minus_spanset_spanset proven +minus_spanset_timestamptz proven +minus_text_set proven +minus_timestamptz_interval proven +minus_timestamptz_set proven +minus_timestamptz_span proven +minus_timestamptz_spanset proven +minus_timestamptz_timestamptz proven +mul_interval_double proven +nad_cbuffer_stbox proven +nad_stbox_geo proven +nad_stbox_stbox proven +nad_stbox_trgeometry wired +nad_tboxfloat_tboxfloat proven +nad_tboxint_tboxint proven +nad_tcbuffer_cbuffer proven +nad_tcbuffer_geo proven +nad_tcbuffer_stbox proven +nad_tcbuffer_tcbuffer proven +nad_tfloat_float proven +nad_tfloat_tbox proven +nad_tfloat_tfloat proven +nad_tgeo_geo proven +nad_tgeo_stbox proven +nad_tgeo_tgeo proven +nad_tint_int proven +nad_tint_tbox proven +nad_tint_tint proven +nad_tnpoint_geo proven +nad_tnpoint_npoint proven +nad_tnpoint_stbox proven +nad_tnpoint_tnpoint proven +nad_tpose_geo proven +nad_tpose_pose proven +nad_tpose_stbox proven +nad_tpose_tpose proven +nad_trgeometry_geo proven +nad_trgeometry_stbox proven +nad_trgeometry_tpoint proven +nad_trgeometry_trgeometry proven +nai_tcbuffer_cbuffer proven +nai_tcbuffer_geo proven +nai_tcbuffer_tcbuffer proven +nai_tgeo_geo proven +nai_tgeo_tgeo proven +nai_tnpoint_geo proven +nai_tnpoint_npoint proven +nai_tnpoint_tnpoint proven +nai_tpose_geo proven +nai_tpose_pose proven +nai_tpose_tpose proven +nai_trgeometry_geo proven +nai_trgeometry_tpoint proven +nai_trgeometry_trgeometry proven +npoint_as_ewkt proven +npoint_as_hexwkb proven +npoint_as_text proven +npoint_as_wkb proven +npoint_cmp proven +npoint_eq proven +npoint_from_hexwkb proven +npoint_from_wkb proven +npoint_ge proven +npoint_gt proven +npoint_hash proven +npoint_hash_extended proven +npoint_in proven +npoint_le proven +npoint_lt proven +npoint_make proven +npoint_ne proven +npoint_out proven +npoint_position proven +npoint_round proven +npoint_route proven +npoint_same proven +npoint_srid proven +npoint_timestamptz_to_stbox proven +npoint_to_geompoint proven +npoint_to_nsegment proven +npoint_to_set proven +npoint_to_stbox proven +npoint_tstzspan_to_stbox proven +npoint_union_transfn proven +npointset_end_value proven +npointset_in proven +npointset_make proven +npointset_out proven +npointset_routes proven +npointset_start_value proven +npointset_value_n proven +npointset_values proven +nsegment_cmp proven +nsegment_eq proven +nsegment_ge proven +nsegment_gt proven +nsegment_in proven +nsegment_le proven +nsegment_lt proven +nsegment_make proven +nsegment_ne proven +nsegment_out proven +nsegment_round proven +nsegment_route proven +nsegment_srid proven +nsegment_to_geom proven +nsegment_to_stbox proven +numset_type proven +numspan_basetype proven +numspan_timestamptz_to_tbox proven +numspan_tstzspan_to_tbox proven +numspan_type proven +overabove_stbox_stbox proven +overabove_stbox_tspatial proven +overabove_tspatial_stbox proven +overabove_tspatial_tspatial proven +overafter_date_set proven +overafter_date_span proven +overafter_date_spanset proven +overafter_set_date proven +overafter_set_timestamptz proven +overafter_span_date proven +overafter_span_timestamptz proven +overafter_spanset_date proven +overafter_spanset_timestamptz proven +overafter_stbox_stbox proven +overafter_stbox_tspatial proven +overafter_tbox_tbox proven +overafter_tbox_tnumber proven +overafter_temporal_temporal proven +overafter_temporal_tstzspan proven +overafter_timestamptz_set proven +overafter_timestamptz_span proven +overafter_timestamptz_spanset proven +overafter_tnumber_tbox proven +overafter_tnumber_tnumber proven +overafter_tspatial_stbox proven +overafter_tspatial_tspatial proven +overafter_tstzspan_temporal proven +overback_stbox_stbox proven +overback_stbox_tspatial proven +overback_tspatial_stbox proven +overback_tspatial_tspatial proven +overbefore_date_set proven +overbefore_date_span proven +overbefore_date_spanset proven +overbefore_set_date proven +overbefore_set_timestamptz proven +overbefore_span_date proven +overbefore_span_timestamptz proven +overbefore_spanset_date proven +overbefore_spanset_timestamptz proven +overbefore_stbox_stbox proven +overbefore_stbox_tspatial proven +overbefore_tbox_tbox proven +overbefore_tbox_tnumber proven +overbefore_temporal_temporal proven +overbefore_temporal_tstzspan proven +overbefore_timestamptz_set proven +overbefore_timestamptz_span proven +overbefore_timestamptz_spanset proven +overbefore_tnumber_tbox proven +overbefore_tnumber_tnumber proven +overbefore_tspatial_stbox proven +overbefore_tspatial_tspatial proven +overbefore_tstzspan_temporal proven +overbelow_stbox_stbox proven +overbelow_stbox_tspatial proven +overbelow_tspatial_stbox proven +overbelow_tspatial_tspatial proven +overfront_stbox_stbox proven +overfront_stbox_tspatial proven +overfront_tspatial_stbox proven +overfront_tspatial_tspatial proven +overlaps_numspan_tnumber proven +overlaps_set_set proven +overlaps_span_span proven +overlaps_span_spanset proven +overlaps_spanset_span proven +overlaps_spanset_spanset proven +overlaps_stbox_stbox proven +overlaps_stbox_tspatial proven +overlaps_tbox_tbox proven +overlaps_tbox_tnumber proven +overlaps_temporal_temporal proven +overlaps_temporal_tstzspan proven +overlaps_tnumber_numspan proven +overlaps_tnumber_tbox proven +overlaps_tnumber_tnumber proven +overlaps_tspatial_stbox proven +overlaps_tspatial_tspatial proven +overlaps_tstzspan_temporal proven +overleft_bigint_set proven +overleft_bigint_span proven +overleft_bigint_spanset proven +overleft_float_set proven +overleft_float_span proven +overleft_float_spanset proven +overleft_int_set proven +overleft_int_span proven +overleft_int_spanset proven +overleft_numspan_tnumber proven +overleft_set_bigint proven +overleft_set_float proven +overleft_set_int proven +overleft_set_set proven +overleft_set_text proven +overleft_span_bigint proven +overleft_span_float proven +overleft_span_int proven +overleft_span_span proven +overleft_span_spanset proven +overleft_spanset_bigint proven +overleft_spanset_float proven +overleft_spanset_int proven +overleft_spanset_span proven +overleft_spanset_spanset proven +overleft_stbox_stbox proven +overleft_stbox_tspatial proven +overleft_tbox_tbox proven +overleft_tbox_tnumber proven +overleft_text_set proven +overleft_tnumber_numspan proven +overleft_tnumber_tbox proven +overleft_tnumber_tnumber proven +overleft_tspatial_stbox proven +overleft_tspatial_tspatial proven +overright_bigint_set proven +overright_bigint_span proven +overright_bigint_spanset proven +overright_float_set proven +overright_float_span proven +overright_float_spanset proven +overright_int_set proven +overright_int_span proven +overright_int_spanset proven +overright_numspan_tnumber proven +overright_set_bigint proven +overright_set_float proven +overright_set_int proven +overright_set_set proven +overright_set_text proven +overright_span_bigint proven +overright_span_float proven +overright_span_int proven +overright_span_span proven +overright_span_spanset proven +overright_spanset_bigint proven +overright_spanset_float proven +overright_spanset_int proven +overright_spanset_span proven +overright_spanset_spanset proven +overright_stbox_stbox proven +overright_stbox_tspatial proven +overright_tbox_tbox proven +overright_tbox_tnumber proven +overright_text_set proven +overright_tnumber_numspan proven +overright_tnumber_tbox proven +overright_tnumber_tnumber proven +overright_tspatial_stbox proven +overright_tspatial_tspatial proven +pg_date_in proven +pg_date_out proven +pg_interval_cmp proven +pg_interval_in proven +pg_interval_out proven +pg_timestamp_in proven +pg_timestamp_out wired +pg_timestamptz_in proven +pg_timestamptz_out proven +pose_as_ewkt proven +pose_as_hexwkb proven +pose_as_text proven +pose_as_wkb proven +pose_cmp proven +pose_copy proven +pose_eq proven +pose_from_hexwkb proven +pose_from_wkb proven +pose_ge proven +pose_gt proven +pose_hash proven +pose_hash_extended proven +pose_in proven +pose_le proven +pose_lt proven +pose_make_2d proven +pose_make_3d proven +pose_make_point2d proven +pose_make_point3d proven +pose_ne proven +pose_nsame proven +pose_orientation proven +pose_out proven +pose_rotation proven +pose_round proven +pose_same proven +pose_set_srid proven +pose_srid proven +pose_timestamptz_to_stbox proven +pose_to_point proven +pose_to_set proven +pose_to_stbox proven +pose_transform proven +pose_transform_pipeline proven +pose_tstzspan_to_stbox proven +pose_union_transfn proven +posearr_round proven +poseset_end_value proven +poseset_in proven +poseset_make proven +poseset_out proven +poseset_start_value proven +poseset_value_n proven +poseset_values proven +right_bigint_set proven +right_bigint_span proven +right_bigint_spanset proven +right_float_set proven +right_float_span proven +right_float_spanset proven +right_int_set proven +right_int_span proven +right_int_spanset proven +right_numspan_tnumber proven +right_set_bigint proven +right_set_float proven +right_set_int proven +right_set_set proven +right_set_text proven +right_span_bigint proven +right_span_float proven +right_span_int proven +right_span_span proven +right_span_spanset proven +right_spanset_bigint proven +right_spanset_float proven +right_spanset_int proven +right_spanset_span proven +right_spanset_spanset proven +right_stbox_stbox proven +right_stbox_tspatial proven +right_tbox_tbox proven +right_tbox_tnumber proven +right_text_set proven +right_tnumber_numspan proven +right_tnumber_tbox proven +right_tnumber_tnumber proven +right_tspatial_stbox proven +right_tspatial_tspatial proven +route_exists proven +route_length proven +rtree_create_bigintspan proven +rtree_create_datespan proven +rtree_create_floatspan proven +rtree_create_intspan proven +rtree_create_stbox proven +rtree_create_tbox proven +rtree_create_tstzspan proven +rtree_free wired +rtree_insert wired +rtree_insert_temporal proven +rtree_search wired +rtree_search_temporal proven +same_numspan_tnumber proven +same_stbox_stbox proven +same_stbox_tspatial proven +same_tbox_tbox proven +same_tbox_tnumber proven +same_temporal_temporal proven +same_temporal_tstzspan proven +same_tnumber_numspan proven +same_tnumber_tbox proven +same_tnumber_tnumber proven +same_tspatial_stbox proven +same_tspatial_tspatial proven +same_tstzspan_temporal proven +set_as_hexwkb proven +set_as_wkb proven +set_basetype proven +set_cmp proven +set_copy proven +set_eq proven +set_extent_transfn proven +set_from_hexwkb proven +set_from_wkb proven +set_ge proven +set_gt proven +set_hash proven +set_hash_extended proven +set_le proven +set_lt proven +set_ne proven +set_num_values proven +set_round proven +set_spans proven +set_spantype proven +set_split_each_n_spans proven +set_split_n_spans proven +set_to_span proven +set_to_spanset proven +set_to_tbox proven +set_type proven +set_union_finalfn proven +set_union_transfn proven +shortestline_tcbuffer_cbuffer proven +shortestline_tcbuffer_geo proven +shortestline_tcbuffer_tcbuffer proven +shortestline_tgeo_geo proven +shortestline_tgeo_tgeo proven +shortestline_tnpoint_geo proven +shortestline_tnpoint_npoint proven +shortestline_tnpoint_tnpoint proven +shortestline_tpose_geo proven +shortestline_tpose_pose proven +shortestline_tpose_tpose proven +shortestline_trgeometry_geo proven +shortestline_trgeometry_tpoint proven +shortestline_trgeometry_trgeometry proven +span_as_hexwkb proven +span_as_wkb proven +span_basetype proven +span_canon_basetype proven +span_cmp proven +span_copy proven +span_eq proven +span_extent_transfn proven +span_from_hexwkb proven +span_from_wkb proven +span_ge proven +span_gt proven +span_hash proven +span_hash_extended proven +span_le proven +span_lower_inc proven +span_lt proven +span_ne proven +span_tbox_type proven +span_to_spanset proven +span_to_tbox proven +span_type proven +span_union_transfn proven +span_upper_inc proven +spanset_as_hexwkb proven +spanset_as_wkb proven +spanset_cmp proven +spanset_copy proven +spanset_end_span proven +spanset_eq proven +spanset_extent_transfn proven +spanset_from_hexwkb proven +spanset_from_wkb proven +spanset_ge proven +spanset_gt proven +spanset_hash proven +spanset_hash_extended proven +spanset_le proven +spanset_lower_inc proven +spanset_lt proven +spanset_make proven +spanset_ne proven +spanset_num_spans proven +spanset_span proven +spanset_span_n proven +spanset_spanarr proven +spanset_spans proven +spanset_split_each_n_spans proven +spanset_split_n_spans proven +spanset_start_span proven +spanset_to_tbox proven +spanset_type proven +spanset_union_finalfn proven +spanset_union_transfn proven +spanset_upper_inc proven +spatial_basetype proven +spatialset_as_ewkt proven +spatialset_as_text proven +spatialset_srid proven +spatialset_to_stbox proven +spatialset_type proven +spheroid_init_from_srid proven +srid_check_latlong wired +srid_is_latlong proven +stbox_area proven +stbox_as_hexwkb proven +stbox_as_wkb proven +stbox_cmp proven +stbox_copy proven +stbox_eq proven +stbox_expand_space proven +stbox_expand_time proven +stbox_from_hexwkb proven +stbox_from_wkb proven +stbox_ge proven +stbox_get_space proven +stbox_get_space_tile proven +stbox_get_space_time_tile proven +stbox_get_time_tile proven +stbox_gt proven +stbox_hash proven +stbox_hash_extended proven +stbox_hast proven +stbox_hasx proven +stbox_hasz proven +stbox_in proven +stbox_isgeodetic proven +stbox_le proven +stbox_lt proven +stbox_make proven +stbox_ne proven +stbox_out proven +stbox_perimeter proven +stbox_quad_split proven +stbox_round proven +stbox_set_srid proven +stbox_shift_scale_time proven +stbox_space_tiles proven +stbox_space_time_tiles proven +stbox_srid proven +stbox_time_tiles proven +stbox_tmax proven +stbox_tmax_inc proven +stbox_tmin proven +stbox_tmin_inc proven +stbox_to_box3d proven +stbox_to_gbox proven +stbox_to_geo proven +stbox_to_tstzspan proven +stbox_transform proven +stbox_transform_pipeline proven +stbox_volume proven +stbox_xmax proven +stbox_xmin proven +stbox_ymax proven +stbox_ymin proven +stbox_zmax proven +stbox_zmin proven +stboxarr_round proven +sub_float_tfloat proven +sub_int_tint proven +sub_tfloat_float proven +sub_tint_int proven +sub_tnumber_tnumber proven +talpha_type proven +talphanum_type proven +tbool_at_value proven +tbool_end_value proven +tbool_from_base_temp proven +tbool_from_mfjson proven +tbool_in proven +tbool_minus_value proven +tbool_out proven +tbool_start_value proven +tbool_tand_transfn proven +tbool_to_tint proven +tbool_tor_transfn proven +tbool_value_at_timestamptz proven +tbool_value_n proven +tbool_values proven +tbool_when_true proven +tboolinst_make proven +tbox_as_hexwkb proven +tbox_as_wkb proven +tbox_cmp proven +tbox_copy proven +tbox_eq proven +tbox_expand_time proven +tbox_from_hexwkb proven +tbox_from_wkb proven +tbox_ge proven +tbox_gt proven +tbox_hash proven +tbox_hash_extended proven +tbox_hast proven +tbox_hasx proven +tbox_in proven +tbox_le proven +tbox_lt proven +tbox_make proven +tbox_ne proven +tbox_out proven +tbox_round proven +tbox_shift_scale_time proven +tbox_tmax proven +tbox_tmax_inc proven +tbox_tmin proven +tbox_tmin_inc proven +tbox_to_floatspan proven +tbox_to_intspan proven +tbox_to_tstzspan proven +tbox_xmax proven +tbox_xmax_inc proven +tbox_xmin proven +tbox_xmin_inc proven +tboxfloat_xmax proven +tboxfloat_xmin proven +tboxint_xmax proven +tboxint_xmin proven +tcbuffer_at_cbuffer proven +tcbuffer_at_geom proven +tcbuffer_at_stbox proven +tcbuffer_expand proven +tcbuffer_from_mfjson proven +tcbuffer_in proven +tcbuffer_make proven +tcbuffer_minus_cbuffer proven +tcbuffer_minus_geom proven +tcbuffer_minus_stbox proven +tcbuffer_points proven +tcbuffer_radius proven +tcbuffer_to_tfloat proven +tcbuffer_to_tgeompoint proven +tcbuffer_trav_area proven +tcontains_cbuffer_tcbuffer proven +tcontains_geo_tcbuffer proven +tcontains_geo_tgeo proven +tcontains_tcbuffer_cbuffer proven +tcontains_tcbuffer_geo proven +tcontains_tcbuffer_tcbuffer proven +tcontains_tgeo_geo proven +tcontains_tgeo_tgeo proven +tcovers_cbuffer_tcbuffer proven +tcovers_geo_tcbuffer proven +tcovers_geo_tgeo proven +tcovers_tcbuffer_cbuffer proven +tcovers_tcbuffer_geo proven +tcovers_tcbuffer_tcbuffer proven +tcovers_tgeo_geo proven +tcovers_tgeo_tgeo proven +tdisjoint_cbuffer_tcbuffer proven +tdisjoint_geo_tcbuffer proven +tdisjoint_geo_tgeo proven +tdisjoint_tcbuffer_cbuffer proven +tdisjoint_tcbuffer_geo proven +tdisjoint_tcbuffer_tcbuffer proven +tdisjoint_tgeo_geo proven +tdisjoint_tgeo_tgeo proven +tdistance_tcbuffer_cbuffer proven +tdistance_tcbuffer_geo proven +tdistance_tcbuffer_tcbuffer proven +tdistance_tfloat_float proven +tdistance_tgeo_geo proven +tdistance_tgeo_tgeo proven +tdistance_tint_int proven +tdistance_tnpoint_npoint proven +tdistance_tnpoint_point proven +tdistance_tnpoint_tnpoint proven +tdistance_tnumber_tnumber proven +tdistance_tpose_point proven +tdistance_tpose_pose proven +tdistance_tpose_tpose proven +tdistance_trgeometry_geo proven +tdistance_trgeometry_tpoint proven +tdistance_trgeometry_trgeometry proven +tdwithin_geo_tcbuffer proven +tdwithin_geo_tgeo proven +tdwithin_tcbuffer_cbuffer proven +tdwithin_tcbuffer_geo proven +tdwithin_tcbuffer_tcbuffer proven +tdwithin_tgeo_geo proven +tdwithin_tgeo_tgeo proven +temparr_round proven +temporal_after_timestamptz proven +temporal_append_tinstant proven +temporal_append_tsequence proven +temporal_as_hexwkb proven +temporal_as_mfjson proven +temporal_as_wkb proven +temporal_at_max proven +temporal_at_min proven +temporal_at_timestamptz proven +temporal_at_tstzset proven +temporal_at_tstzspan proven +temporal_at_tstzspanset proven +temporal_at_values proven +temporal_basetype proven +temporal_before_timestamptz proven +temporal_cmp proven +temporal_copy proven +temporal_delete_timestamptz proven +temporal_delete_tstzset proven +temporal_delete_tstzspan proven +temporal_delete_tstzspanset proven +temporal_derivative proven +temporal_duration proven +temporal_dyntimewarp_distance proven +temporal_dyntimewarp_path proven +temporal_end_instant proven +temporal_end_sequence proven +temporal_end_timestamptz proven +temporal_eq proven +temporal_extent_transfn proven +temporal_frechet_distance proven +temporal_frechet_path proven +temporal_from_hexwkb proven +temporal_from_wkb proven +temporal_ge proven +temporal_gt proven +temporal_hash proven +temporal_hausdorff_distance proven +temporal_insert proven +temporal_instant_n proven +temporal_instants proven +temporal_interp proven +temporal_le proven +temporal_lower_inc proven +temporal_lt proven +temporal_max_instant proven +temporal_merge proven +temporal_merge_array proven +temporal_merge_combinefn proven +temporal_merge_transfn proven +temporal_min_instant proven +temporal_minus_max proven +temporal_minus_min proven +temporal_minus_timestamptz proven +temporal_minus_tstzset proven +temporal_minus_tstzspan proven +temporal_minus_tstzspanset proven +temporal_minus_values proven +temporal_ne proven +temporal_num_instants proven +temporal_num_sequences proven +temporal_num_timestamps proven +temporal_round proven +temporal_scale_time proven +temporal_segm_duration proven +temporal_segments proven +temporal_sequence_n proven +temporal_sequences proven +temporal_set_interp proven +temporal_shift_scale_time proven +temporal_shift_time proven +temporal_simplify_dp proven +temporal_simplify_max_dist proven +temporal_simplify_min_dist proven +temporal_simplify_min_tdelta proven +temporal_spans proven +temporal_split_each_n_spans proven +temporal_split_n_spans proven +temporal_start_instant proven +temporal_start_sequence proven +temporal_start_timestamptz proven +temporal_stops proven +temporal_subtype proven +temporal_tagg_finalfn proven +temporal_tcount_transfn proven +temporal_time proven +temporal_time_bins proven +temporal_time_split proven +temporal_timestamps proven +temporal_timestamptz_n proven +temporal_to_tinstant proven +temporal_to_tsequence proven +temporal_to_tsequenceset proven +temporal_to_tstzspan proven +temporal_tprecision proven +temporal_tsample proven +temporal_type proven +temporal_update proven +temporal_upper_inc proven +tempsubtype_from_string proven +tempsubtype_name proven +temptype_basetype proven +temptype_subtype wired +temptype_subtype_all wired +teq_bool_tbool proven +teq_cbuffer_tcbuffer proven +teq_float_tfloat proven +teq_geo_tgeo proven +teq_geo_trgeometry proven +teq_int_tint proven +teq_pose_tpose proven +teq_tbool_bool proven +teq_tcbuffer_cbuffer proven +teq_temporal_temporal proven +teq_text_ttext proven +teq_tfloat_float proven +teq_tgeo_geo proven +teq_tint_int proven +teq_tnpoint_npoint proven +teq_tpose_pose proven +teq_trgeometry_geo proven +teq_ttext_text proven +text2cstring wired +text_cmp proven +text_copy proven +text_in proven +text_initcap proven +text_lower proven +text_out proven +text_to_set proven +text_union_transfn proven +text_upper proven +textcat_text_text proven +textcat_text_textset proven +textcat_text_ttext proven +textcat_textset_text proven +textcat_ttext_text proven +textcat_ttext_ttext proven +textset_end_value proven +textset_in proven +textset_initcap proven +textset_lower proven +textset_make proven +textset_out proven +textset_start_value proven +textset_upper proven +textset_value_n proven +textset_values proven +tfloat_at_value proven +tfloat_avg_value wired +tfloat_ceil proven +tfloat_degrees proven +tfloat_end_value proven +tfloat_exp proven +tfloat_floor proven +tfloat_from_base_temp proven +tfloat_from_mfjson proven +tfloat_in proven +tfloat_ln proven +tfloat_log10 proven +tfloat_max_value proven +tfloat_min_value proven +tfloat_minus_value proven +tfloat_out proven +tfloat_radians proven +tfloat_scale_value proven +tfloat_shift_scale_value proven +tfloat_shift_value proven +tfloat_start_value proven +tfloat_time_boxes proven +tfloat_tmax_transfn proven +tfloat_tmin_transfn proven +tfloat_to_tint proven +tfloat_tsum_transfn proven +tfloat_value_at_timestamptz proven +tfloat_value_bins proven +tfloat_value_boxes proven +tfloat_value_n proven +tfloat_value_split proven +tfloat_value_time_boxes proven +tfloat_value_time_split proven +tfloat_values proven +tfloat_wmax_transfn proven +tfloat_wmin_transfn proven +tfloat_wsum_transfn proven +tfloatbox_expand proven +tfloatbox_shift_scale proven +tfloatinst_make proven +tge_float_tfloat proven +tge_int_tint proven +tge_temporal_temporal proven +tge_text_ttext proven +tge_tfloat_float proven +tge_tint_int proven +tge_ttext_text proven +tgeo_affine proven +tgeo_at_geom proven +tgeo_at_stbox proven +tgeo_at_value proven +tgeo_centroid proven +tgeo_convex_hull proven +tgeo_end_value proven +tgeo_from_base_temp proven +tgeo_minus_geom proven +tgeo_minus_stbox proven +tgeo_minus_value proven +tgeo_scale proven +tgeo_space_boxes proven +tgeo_space_split proven +tgeo_space_time_boxes proven +tgeo_space_time_split proven +tgeo_split_each_n_stboxes proven +tgeo_split_n_stboxes proven +tgeo_start_value proven +tgeo_stboxes proven +tgeo_traversed_area proven +tgeo_type proven +tgeo_type_all proven +tgeo_value_at_timestamptz proven +tgeo_value_n proven +tgeo_values proven +tgeodetic_type proven +tgeogpoint_from_mfjson proven +tgeogpoint_in proven +tgeogpoint_to_tgeography proven +tgeography_from_mfjson proven +tgeography_in proven +tgeography_to_tgeogpoint proven +tgeography_to_tgeometry proven +tgeoinst_make proven +tgeometry_from_mfjson proven +tgeometry_in proven +tgeometry_to_tcbuffer proven +tgeometry_to_tgeography proven +tgeometry_to_tgeompoint proven +tgeometry_type proven +tgeompoint_from_mfjson proven +tgeompoint_in proven +tgeompoint_to_tgeometry proven +tgeompoint_to_tnpoint proven +tgt_float_tfloat proven +tgt_int_tint proven +tgt_temporal_temporal proven +tgt_text_ttext proven +tgt_tfloat_float proven +tgt_tint_int proven +tgt_ttext_text proven +time_type proven +timeset_type proven +timespan_basetype proven +timespan_type proven +timespanset_type proven +timestamp_to_date proven +timestamptz_extent_transfn proven +timestamptz_get_bin proven +timestamptz_shift proven +timestamptz_tcount_transfn proven +timestamptz_to_date proven +timestamptz_to_set proven +timestamptz_to_span proven +timestamptz_to_spanset proven +timestamptz_to_stbox proven +timestamptz_to_tbox proven +timestamptz_tprecision proven +timestamptz_union_transfn proven +tint_at_value proven +tint_end_value proven +tint_from_base_temp proven +tint_from_mfjson proven +tint_in proven +tint_max_value proven +tint_min_value proven +tint_minus_value proven +tint_out proven +tint_scale_value proven +tint_shift_scale_value proven +tint_shift_value proven +tint_start_value proven +tint_time_boxes proven +tint_tmax_transfn proven +tint_tmin_transfn proven +tint_to_tfloat proven +tint_tsum_transfn proven +tint_value_at_timestamptz proven +tint_value_bins proven +tint_value_boxes proven +tint_value_n proven +tint_value_split proven +tint_value_time_boxes proven +tint_value_time_split proven +tint_values proven +tint_wmax_transfn proven +tint_wmin_transfn proven +tint_wsum_transfn proven +tintbox_expand proven +tintbox_shift_scale proven +tintersects_cbuffer_tcbuffer proven +tintersects_geo_tcbuffer proven +tintersects_geo_tgeo proven +tintersects_tcbuffer_cbuffer proven +tintersects_tcbuffer_geo proven +tintersects_tcbuffer_tcbuffer proven +tintersects_tgeo_geo proven +tintersects_tgeo_tgeo proven +tintinst_make proven +tle_float_tfloat proven +tle_int_tint proven +tle_temporal_temporal proven +tle_text_ttext proven +tle_tfloat_float proven +tle_tint_int proven +tle_ttext_text proven +tlt_float_tfloat proven +tlt_int_tint proven +tlt_temporal_temporal proven +tlt_text_ttext proven +tlt_tfloat_float proven +tlt_tint_int proven +tlt_ttext_text proven +tne_bool_tbool proven +tne_cbuffer_tcbuffer proven +tne_float_tfloat proven +tne_geo_tgeo proven +tne_geo_trgeometry proven +tne_int_tint proven +tne_pose_tpose proven +tne_tbool_bool proven +tne_tcbuffer_cbuffer proven +tne_temporal_temporal proven +tne_text_ttext proven +tne_tfloat_float proven +tne_tgeo_geo proven +tne_tint_int proven +tne_tnpoint_npoint proven +tne_tpose_pose proven +tne_trgeometry_geo proven +tne_ttext_text proven +tnpoint_at_geom proven +tnpoint_at_npoint proven +tnpoint_at_npointset proven +tnpoint_at_stbox proven +tnpoint_cumulative_length proven +tnpoint_from_mfjson proven +tnpoint_in proven +tnpoint_length proven +tnpoint_minus_geom proven +tnpoint_minus_npoint proven +tnpoint_minus_npointset proven +tnpoint_minus_stbox proven +tnpoint_out proven +tnpoint_positions proven +tnpoint_route proven +tnpoint_routes proven +tnpoint_speed proven +tnpoint_tcentroid_transfn proven +tnpoint_to_tgeompoint proven +tnpoint_trajectory proven +tnpoint_twcentroid proven +tnpointinst_make proven +tnumber_abs proven +tnumber_angular_difference proven +tnumber_at_span proven +tnumber_at_spanset proven +tnumber_at_tbox proven +tnumber_avg_value proven +tnumber_basetype proven +tnumber_delta_value proven +tnumber_extent_transfn proven +tnumber_integral proven +tnumber_minus_span proven +tnumber_minus_spanset proven +tnumber_minus_tbox proven +tnumber_spantype proven +tnumber_split_each_n_tboxes proven +tnumber_split_n_tboxes proven +tnumber_tavg_finalfn proven +tnumber_tavg_transfn proven +tnumber_tboxes proven +tnumber_to_span proven +tnumber_to_tbox proven +tnumber_trend proven +tnumber_twavg proven +tnumber_type proven +tnumber_valuespans proven +tnumber_wavg_transfn proven +touches_cbuffer_cbuffer proven +tpoint_angular_difference proven +tpoint_as_mvtgeom proven +tpoint_at_elevation proven +tpoint_at_geom proven +tpoint_at_value proven +tpoint_azimuth proven +tpoint_cumulative_length proven +tpoint_direction proven +tpoint_from_base_temp proven +tpoint_get_x proven +tpoint_get_y proven +tpoint_get_z proven +tpoint_is_simple proven +tpoint_length proven +tpoint_make_simple proven +tpoint_minus_elevation proven +tpoint_minus_geom proven +tpoint_minus_value proven +tpoint_speed proven +tpoint_tcentroid_finalfn proven +tpoint_tcentroid_transfn proven +tpoint_tfloat_to_geomeas proven +tpoint_trajectory proven +tpoint_twcentroid proven +tpoint_type proven +tpointinst_make proven +tpose_at_geom proven +tpose_at_pose proven +tpose_at_stbox proven +tpose_end_value proven +tpose_in proven +tpose_make proven +tpose_minus_geom proven +tpose_minus_pose proven +tpose_minus_stbox proven +tpose_points proven +tpose_rotation proven +tpose_start_value proven +tpose_to_tpoint proven +tpose_trajectory proven +tpose_value_at_timestamptz proven +tpose_value_n proven +tpose_values proven +trgeometry_after_timestamptz proven +trgeometry_append_tinstant proven +trgeometry_append_tsequence proven +trgeometry_before_timestamptz proven +trgeometry_delete_timestamptz proven +trgeometry_delete_tstzset proven +trgeometry_delete_tstzspan proven +trgeometry_delete_tstzspanset proven +trgeometry_end_instant proven +trgeometry_end_sequence proven +trgeometry_end_value proven +trgeometry_geom proven +trgeometry_instant_n proven +trgeometry_instants proven +trgeometry_out proven +trgeometry_points proven +trgeometry_restrict_timestamptz proven +trgeometry_restrict_tstzset proven +trgeometry_restrict_tstzspan proven +trgeometry_restrict_tstzspanset proven +trgeometry_restrict_value proven +trgeometry_restrict_values proven +trgeometry_rotation proven +trgeometry_round proven +trgeometry_segments proven +trgeometry_sequence_n proven +trgeometry_sequences proven +trgeometry_set_interp proven +trgeometry_start_instant proven +trgeometry_start_sequence proven +trgeometry_start_value proven +trgeometry_to_tinstant proven +trgeometry_to_tpoint proven +trgeometry_to_tpose proven +trgeometry_traversed_area proven +trgeometry_value_n proven +trgeometryinst_make proven +tsequenceset_make_gaps proven +tspatial_as_ewkt proven +tspatial_as_text proven +tspatial_extent_transfn proven +tspatial_out proven +tspatial_set_srid proven +tspatial_srid proven +tspatial_to_stbox proven +tspatial_transform proven +tspatial_transform_pipeline proven +tspatial_type proven +tstzset_end_value proven +tstzset_in proven +tstzset_make proven +tstzset_out proven +tstzset_shift_scale proven +tstzset_start_value proven +tstzset_tcount_transfn proven +tstzset_to_dateset proven +tstzset_to_stbox proven +tstzset_tprecision proven +tstzset_value_n proven +tstzset_values proven +tstzspan_bins proven +tstzspan_duration proven +tstzspan_expand proven +tstzspan_in proven +tstzspan_lower proven +tstzspan_make proven +tstzspan_out proven +tstzspan_shift_scale proven +tstzspan_tcount_transfn proven +tstzspan_to_datespan proven +tstzspan_to_stbox proven +tstzspan_tprecision proven +tstzspan_upper proven +tstzspanset_bins proven +tstzspanset_duration proven +tstzspanset_end_timestamptz proven +tstzspanset_in proven +tstzspanset_lower proven +tstzspanset_num_timestamps proven +tstzspanset_out proven +tstzspanset_shift_scale proven +tstzspanset_start_timestamptz proven +tstzspanset_tcount_transfn proven +tstzspanset_timestamps proven +tstzspanset_timestamptz_n proven +tstzspanset_to_datespanset proven +tstzspanset_to_stbox proven +tstzspanset_tprecision proven +tstzspanset_upper proven +ttext_at_value proven +ttext_end_value proven +ttext_from_base_temp proven +ttext_from_mfjson proven +ttext_in proven +ttext_initcap proven +ttext_lower proven +ttext_max_value proven +ttext_min_value proven +ttext_minus_value proven +ttext_out proven +ttext_start_value proven +ttext_tmax_transfn proven +ttext_tmin_transfn proven +ttext_upper proven +ttext_value_at_timestamptz proven +ttext_value_n proven +ttext_values proven +ttextinst_make proven +ttouches_cbuffer_tcbuffer proven +ttouches_geo_tcbuffer proven +ttouches_geo_tgeo proven +ttouches_tcbuffer_cbuffer proven +ttouches_tcbuffer_geo proven +ttouches_tcbuffer_tcbuffer proven +ttouches_tgeo_geo proven +ttouches_tgeo_tgeo proven +type_span_bbox proven +union_bigint_set proven +union_bigint_span proven +union_bigint_spanset proven +union_date_set proven +union_date_span proven +union_date_spanset proven +union_float_set proven +union_float_span proven +union_float_spanset proven +union_geo_set proven +union_int_set proven +union_int_span proven +union_int_spanset proven +union_set_bigint proven +union_set_cbuffer proven +union_set_date proven +union_set_float proven +union_set_geo proven +union_set_int proven +union_set_npoint proven +union_set_pose proven +union_set_set proven +union_set_text proven +union_set_timestamptz proven +union_span_bigint proven +union_span_date proven +union_span_float proven +union_span_int proven +union_span_span proven +union_span_spanset proven +union_span_timestamptz proven +union_spanset_bigint proven +union_spanset_date proven +union_spanset_float proven +union_spanset_int proven +union_spanset_span proven +union_spanset_spanset proven +union_spanset_timestamptz proven +union_stbox_stbox proven +union_tbox_tbox proven +union_text_set proven +union_timestamptz_set proven +union_timestamptz_span proven +union_timestamptz_spanset proven diff --git a/tools/streaming_parity/feeds/nebula.feed.tsv b/tools/streaming_parity/feeds/nebula.feed.tsv new file mode 100644 index 0000000000..2472fe6144 --- /dev/null +++ b/tools/streaming_parity/feeds/nebula.feed.tsv @@ -0,0 +1,324 @@ +above_stbox_tspatial wired +above_tspatial_stbox wired +above_tspatial_tspatial wired +acontains_tcbuffer_cbuffer wired +acontains_tcbuffer_geo wired +acontains_tgeo_geo wired +acontains_tgeo_tgeo wired +acovers_tcbuffer_cbuffer wired +acovers_tcbuffer_geo wired +adisjoint_tcbuffer_cbuffer wired +adisjoint_tcbuffer_geo wired +adisjoint_tcbuffer_tcbuffer wired +adisjoint_tgeo_geo wired +adisjoint_tgeo_tgeo wired +adjacent_stbox_tspatial wired +adjacent_tbox_tnumber wired +adjacent_temporal_temporal wired +adjacent_tnumber_tbox wired +adjacent_tspatial_stbox wired +adjacent_tspatial_tspatial wired +adwithin_tcbuffer_cbuffer wired +adwithin_tcbuffer_geo wired +adwithin_tcbuffer_tcbuffer wired +adwithin_tgeo_geo wired +adwithin_tgeo_tgeo wired +after_stbox_tspatial wired +after_tbox_tnumber wired +after_temporal_temporal wired +after_tnumber_tbox wired +after_tspatial_stbox wired +after_tspatial_tspatial wired +aintersects_tcbuffer_cbuffer wired +aintersects_tcbuffer_geo wired +aintersects_tcbuffer_tcbuffer wired +aintersects_tgeo_geo wired +aintersects_tgeo_tgeo wired +always_eq_float_tfloat wired +always_eq_int_tint wired +always_eq_tbool_bool wired +always_eq_tcbuffer_cbuffer wired +always_eq_tcbuffer_tcbuffer wired +always_eq_temporal_temporal wired +always_eq_tfloat_float wired +always_eq_tgeo_geo wired +always_eq_tgeo_tgeo wired +always_eq_tint_int wired +always_ge_float_tfloat wired +always_ge_int_tint wired +always_ge_temporal_temporal wired +always_ge_tfloat_float wired +always_ge_tint_int wired +always_gt_float_tfloat wired +always_gt_int_tint wired +always_gt_temporal_temporal wired +always_gt_tfloat_float wired +always_gt_tint_int wired +always_le_float_tfloat wired +always_le_int_tint wired +always_le_temporal_temporal wired +always_le_tfloat_float wired +always_le_tint_int wired +always_lt_float_tfloat wired +always_lt_int_tint wired +always_lt_temporal_temporal wired +always_lt_tfloat_float wired +always_lt_tint_int wired +always_ne_float_tfloat wired +always_ne_int_tint wired +always_ne_tbool_bool wired +always_ne_tcbuffer_cbuffer wired +always_ne_tcbuffer_tcbuffer wired +always_ne_temporal_temporal wired +always_ne_tfloat_float wired +always_ne_tgeo_geo wired +always_ne_tgeo_tgeo wired +always_ne_tint_int wired +atouches_tcbuffer_cbuffer wired +atouches_tcbuffer_geo wired +atouches_tcbuffer_tcbuffer wired +atouches_tgeo_geo wired +atouches_tgeo_tgeo wired +atouches_tpoint_geo wired +back_stbox_tspatial wired +back_tspatial_stbox wired +back_tspatial_tspatial wired +before_stbox_tspatial wired +before_tbox_tnumber wired +before_temporal_temporal wired +before_tnumber_tbox wired +before_tspatial_stbox wired +before_tspatial_tspatial wired +below_stbox_tspatial wired +below_tspatial_stbox wired +below_tspatial_tspatial wired +bigint_extent_transfn wired +bigint_union_transfn wired +contained_stbox_tspatial wired +contained_tbox_tnumber wired +contained_temporal_temporal wired +contained_tnumber_tbox wired +contained_tspatial_stbox wired +contained_tspatial_tspatial wired +contains_stbox_tspatial wired +contains_tbox_tnumber wired +contains_temporal_temporal wired +contains_tnumber_tbox wired +contains_tspatial_stbox wired +contains_tspatial_tspatial wired +econtains_tcbuffer_cbuffer wired +econtains_tcbuffer_geo wired +econtains_tgeo_geo wired +econtains_tgeo_tgeo wired +ecovers_tcbuffer_cbuffer wired +ecovers_tcbuffer_geo wired +ecovers_tcbuffer_tcbuffer wired +ecovers_tgeo_geo wired +ecovers_tgeo_tgeo wired +edisjoint_tcbuffer_cbuffer wired +edisjoint_tcbuffer_geo wired +edisjoint_tgeo_geo wired +edisjoint_tgeo_tgeo proven +edwithin_tcbuffer_cbuffer wired +edwithin_tcbuffer_geo wired +edwithin_tcbuffer_tcbuffer wired +edwithin_tgeo_geo wired +edwithin_tgeo_tgeo wired +eintersects_tcbuffer_cbuffer wired +eintersects_tcbuffer_geo wired +eintersects_tcbuffer_tcbuffer proven +eintersects_tgeo_geo wired +eintersects_tgeo_tgeo proven +etouches_tcbuffer_cbuffer wired +etouches_tcbuffer_geo wired +etouches_tcbuffer_tcbuffer wired +etouches_tgeo_geo wired +etouches_tgeo_tgeo wired +etouches_tpoint_geo wired +ever_eq_float_tfloat wired +ever_eq_int_tint wired +ever_eq_tbool_bool wired +ever_eq_tcbuffer_cbuffer wired +ever_eq_tcbuffer_tcbuffer wired +ever_eq_temporal_temporal wired +ever_eq_tfloat_float wired +ever_eq_tgeo_geo wired +ever_eq_tgeo_tgeo wired +ever_eq_tint_int wired +ever_ge_float_tfloat wired +ever_ge_int_tint wired +ever_ge_temporal_temporal wired +ever_ge_tfloat_float wired +ever_ge_tint_int wired +ever_gt_float_tfloat wired +ever_gt_int_tint wired +ever_gt_temporal_temporal wired +ever_gt_tfloat_float wired +ever_gt_tint_int wired +ever_le_float_tfloat wired +ever_le_int_tint wired +ever_le_temporal_temporal wired +ever_le_tfloat_float wired +ever_le_tint_int wired +ever_lt_float_tfloat wired +ever_lt_int_tint wired +ever_lt_temporal_temporal wired +ever_lt_tfloat_float wired +ever_lt_tint_int wired +ever_ne_float_tfloat wired +ever_ne_int_tint wired +ever_ne_tbool_bool wired +ever_ne_tcbuffer_cbuffer wired +ever_ne_tcbuffer_tcbuffer wired +ever_ne_temporal_temporal wired +ever_ne_tfloat_float wired +ever_ne_tgeo_geo wired +ever_ne_tgeo_tgeo wired +ever_ne_tint_int wired +float_extent_transfn wired +float_union_transfn wired +front_stbox_tspatial wired +front_tspatial_stbox wired +front_tspatial_tspatial wired +geog_dwithin wired +geom_to_geog wired +int_extent_transfn wired +int_union_transfn wired +left_stbox_tspatial wired +left_tbox_tnumber wired +left_tnumber_tbox wired +left_tspatial_stbox wired +left_tspatial_tspatial wired +nad_tcbuffer_cbuffer wired +nad_tcbuffer_geo wired +nad_tcbuffer_stbox wired +nad_tcbuffer_tcbuffer proven +nad_tfloat_float wired +nad_tfloat_tbox wired +nad_tfloat_tfloat proven +nad_tgeo_geo wired +nad_tgeo_stbox wired +nad_tgeo_tgeo proven +nad_tint_int wired +nad_tint_tbox wired +nad_tint_tint wired +nad_tnpoint_geo wired +nad_tnpoint_stbox wired +nad_tpose_geo wired +nad_tpose_stbox wired +overabove_stbox_tspatial wired +overabove_tspatial_stbox wired +overabove_tspatial_tspatial wired +overafter_stbox_tspatial wired +overafter_tbox_tnumber wired +overafter_temporal_temporal wired +overafter_tnumber_tbox wired +overafter_tspatial_stbox wired +overafter_tspatial_tspatial wired +overback_stbox_tspatial wired +overback_tspatial_stbox wired +overback_tspatial_tspatial wired +overbefore_stbox_tspatial wired +overbefore_tbox_tnumber wired +overbefore_temporal_temporal wired +overbefore_tnumber_tbox wired +overbefore_tspatial_stbox wired +overbefore_tspatial_tspatial wired +overbelow_stbox_tspatial wired +overbelow_tspatial_stbox wired +overbelow_tspatial_tspatial wired +overfront_stbox_tspatial wired +overfront_tspatial_stbox wired +overfront_tspatial_tspatial wired +overlaps_stbox_tspatial wired +overlaps_tbox_tnumber wired +overlaps_temporal_temporal wired +overlaps_tnumber_tbox wired +overlaps_tspatial_stbox wired +overlaps_tspatial_tspatial wired +overleft_stbox_tspatial wired +overleft_tbox_tnumber wired +overleft_tnumber_tbox wired +overleft_tspatial_stbox wired +overleft_tspatial_tspatial wired +overright_stbox_tspatial wired +overright_tbox_tnumber wired +overright_tnumber_tbox wired +overright_tspatial_stbox wired +overright_tspatial_tspatial wired +right_stbox_tspatial wired +right_tbox_tnumber wired +right_tnumber_tbox wired +right_tspatial_stbox wired +right_tspatial_tspatial wired +same_stbox_tspatial wired +same_tbox_tnumber wired +same_temporal_temporal wired +same_tnumber_tbox wired +same_tspatial_stbox wired +same_tspatial_tspatial wired +set_union_finalfn wired +tbool_end_value wired +tbool_start_value wired +tbool_to_tint wired +tcbuffer_to_tfloat wired +temporal_append_tinstant wired +temporal_at_max wired +temporal_at_min wired +temporal_cmp wired +temporal_copy wired +temporal_derivative wired +temporal_dyntimewarp_distance wired +temporal_end_timestamptz wired +temporal_eq wired +temporal_frechet_distance wired +temporal_ge wired +temporal_gt wired +temporal_hausdorff_distance wired +temporal_le wired +temporal_lower_inc wired +temporal_lt wired +temporal_merge wired +temporal_minus_max wired +temporal_minus_min wired +temporal_ne wired +temporal_num_instants wired +temporal_num_sequences wired +temporal_num_timestamps wired +temporal_start_timestamptz wired +temporal_upper_inc wired +tfloat_ceil wired +tfloat_end_value wired +tfloat_exp wired +tfloat_floor wired +tfloat_ln wired +tfloat_log10 wired +tfloat_max_value wired +tfloat_min_value wired +tfloat_radians wired +tfloat_start_value wired +tfloat_to_tint wired +tgeo_at_geom wired +tgeo_centroid wired +tgeo_minus_geom wired +tgeompoint_to_tgeometry wired +timestamptz_extent_transfn wired +timestamptz_union_transfn wired +tint_end_value wired +tint_max_value wired +tint_min_value wired +tint_start_value wired +tint_to_tfloat wired +tnpoint_length wired +tnumber_abs wired +tnumber_angular_difference wired +tnumber_avg_value wired +tnumber_delta_value wired +tnumber_extent_transfn wired +tnumber_integral wired +tnumber_twavg wired +tpoint_angular_difference wired +tpoint_azimuth wired +tpoint_is_simple wired +tpoint_length wired +tspatial_extent_transfn wired diff --git a/tools/streaming_parity/feeds/streamable.txt b/tools/streaming_parity/feeds/streamable.txt new file mode 100644 index 0000000000..2974a36401 --- /dev/null +++ b/tools/streaming_parity/feeds/streamable.txt @@ -0,0 +1,1945 @@ +above_stbox_stbox +above_stbox_tspatial +above_tspatial_stbox +above_tspatial_tspatial +acontains_cbuffer_tcbuffer +acontains_geo_tcbuffer +acontains_geo_tgeo +acontains_tcbuffer_cbuffer +acontains_tcbuffer_geo +acontains_tgeo_geo +acontains_tgeo_tgeo +acovers_cbuffer_tcbuffer +acovers_geo_tcbuffer +acovers_tcbuffer_cbuffer +acovers_tcbuffer_geo +add_date_int +add_float_tfloat +add_int_tint +add_interval_interval +add_tfloat_float +add_timestamptz_interval +add_tint_int +add_tnumber_tnumber +adisjoint_tcbuffer_cbuffer +adisjoint_tcbuffer_geo +adisjoint_tcbuffer_tcbuffer +adisjoint_tgeo_geo +adisjoint_tgeo_tgeo +adjacent_numspan_tnumber +adjacent_span_bigint +adjacent_span_date +adjacent_span_float +adjacent_span_int +adjacent_span_span +adjacent_span_spanset +adjacent_span_timestamptz +adjacent_spanset_bigint +adjacent_spanset_date +adjacent_spanset_float +adjacent_spanset_int +adjacent_spanset_span +adjacent_spanset_spanset +adjacent_spanset_timestamptz +adjacent_stbox_stbox +adjacent_stbox_tspatial +adjacent_tbox_tbox +adjacent_tbox_tnumber +adjacent_temporal_temporal +adjacent_temporal_tstzspan +adjacent_tnumber_numspan +adjacent_tnumber_tbox +adjacent_tnumber_tnumber +adjacent_tspatial_stbox +adjacent_tspatial_tspatial +adjacent_tstzspan_temporal +adwithin_tcbuffer_cbuffer +adwithin_tcbuffer_geo +adwithin_tcbuffer_tcbuffer +adwithin_tgeo_geo +adwithin_tgeo_tgeo +after_date_set +after_date_span +after_date_spanset +after_set_date +after_set_timestamptz +after_span_date +after_span_timestamptz +after_spanset_date +after_spanset_timestamptz +after_stbox_stbox +after_stbox_tspatial +after_tbox_tbox +after_tbox_tnumber +after_temporal_temporal +after_temporal_tstzspan +after_timestamptz_set +after_timestamptz_span +after_timestamptz_spanset +after_tnumber_tbox +after_tnumber_tnumber +after_tspatial_stbox +after_tspatial_tspatial +after_tstzspan_temporal +aintersects_tcbuffer_cbuffer +aintersects_tcbuffer_geo +aintersects_tcbuffer_tcbuffer +aintersects_tgeo_geo +aintersects_tgeo_tgeo +alphanum_basetype +alphanum_temptype +alphanumset_type +always_eq_bool_tbool +always_eq_cbuffer_tcbuffer +always_eq_float_tfloat +always_eq_geo_tgeo +always_eq_geo_trgeometry +always_eq_int_tint +always_eq_npoint_tnpoint +always_eq_pose_tpose +always_eq_tbool_bool +always_eq_tcbuffer_cbuffer +always_eq_tcbuffer_tcbuffer +always_eq_temporal_temporal +always_eq_text_ttext +always_eq_tfloat_float +always_eq_tgeo_geo +always_eq_tgeo_tgeo +always_eq_tint_int +always_eq_tnpoint_npoint +always_eq_tnpoint_tnpoint +always_eq_tpose_pose +always_eq_tpose_tpose +always_eq_trgeometry_geo +always_eq_trgeometry_trgeometry +always_eq_ttext_text +always_ge_float_tfloat +always_ge_int_tint +always_ge_temporal_temporal +always_ge_text_ttext +always_ge_tfloat_float +always_ge_tint_int +always_ge_ttext_text +always_gt_float_tfloat +always_gt_int_tint +always_gt_temporal_temporal +always_gt_text_ttext +always_gt_tfloat_float +always_gt_tint_int +always_gt_ttext_text +always_le_float_tfloat +always_le_int_tint +always_le_temporal_temporal +always_le_text_ttext +always_le_tfloat_float +always_le_tint_int +always_le_ttext_text +always_lt_float_tfloat +always_lt_int_tint +always_lt_temporal_temporal +always_lt_text_ttext +always_lt_tfloat_float +always_lt_tint_int +always_lt_ttext_text +always_ne_bool_tbool +always_ne_cbuffer_tcbuffer +always_ne_float_tfloat +always_ne_geo_tgeo +always_ne_geo_trgeometry +always_ne_int_tint +always_ne_npoint_tnpoint +always_ne_pose_tpose +always_ne_tbool_bool +always_ne_tcbuffer_cbuffer +always_ne_tcbuffer_tcbuffer +always_ne_temporal_temporal +always_ne_text_ttext +always_ne_tfloat_float +always_ne_tgeo_geo +always_ne_tgeo_tgeo +always_ne_tint_int +always_ne_tnpoint_npoint +always_ne_tnpoint_tnpoint +always_ne_tpose_pose +always_ne_tpose_tpose +always_ne_trgeometry_geo +always_ne_trgeometry_trgeometry +always_ne_ttext_text +atouches_tcbuffer_cbuffer +atouches_tcbuffer_geo +atouches_tcbuffer_tcbuffer +atouches_tgeo_geo +atouches_tgeo_tgeo +atouches_tpoint_geo +back_stbox_stbox +back_stbox_tspatial +back_tspatial_stbox +back_tspatial_tspatial +basetype_byvalue +basetype_varlength +bearing_point_point +before_date_set +before_date_span +before_date_spanset +before_set_date +before_set_timestamptz +before_span_date +before_span_timestamptz +before_spanset_date +before_spanset_timestamptz +before_stbox_stbox +before_stbox_tspatial +before_tbox_tbox +before_tbox_tnumber +before_temporal_temporal +before_temporal_tstzspan +before_timestamptz_set +before_timestamptz_span +before_timestamptz_spanset +before_tnumber_tbox +before_tnumber_tnumber +before_tspatial_stbox +before_tspatial_tspatial +before_tstzspan_temporal +below_stbox_stbox +below_stbox_tspatial +below_tspatial_stbox +below_tspatial_tspatial +bigint_extent_transfn +bigint_get_bin +bigint_to_set +bigint_to_span +bigint_to_spanset +bigint_union_transfn +bigintset_end_value +bigintset_make +bigintset_shift_scale +bigintset_start_value +bigintset_value_n +bigintset_values +bigintspan_bins +bigintspan_expand +bigintspan_lower +bigintspan_make +bigintspan_shift_scale +bigintspan_upper +bigintspan_width +bigintspanset_bins +bigintspanset_lower +bigintspanset_shift_scale +bigintspanset_upper +bigintspanset_width +box3d_make +box3d_to_stbox +cbuffer_cmp +cbuffer_copy +cbuffer_eq +cbuffer_ge +cbuffer_gt +cbuffer_hash +cbuffer_hash_extended +cbuffer_le +cbuffer_lt +cbuffer_make +cbuffer_ne +cbuffer_nsame +cbuffer_point +cbuffer_radius +cbuffer_round +cbuffer_same +cbuffer_set_srid +cbuffer_srid +cbuffer_timestamptz_to_stbox +cbuffer_to_geom +cbuffer_to_set +cbuffer_to_stbox +cbuffer_transform +cbuffer_transform_pipeline +cbuffer_tstzspan_to_stbox +cbuffer_union_transfn +cbufferarr_round +cbufferarr_to_geom +cbufferset_end_value +cbufferset_make +cbufferset_start_value +cbufferset_value_n +cbufferset_values +contained_bigint_set +contained_bigint_span +contained_bigint_spanset +contained_cbuffer_set +contained_date_set +contained_date_span +contained_date_spanset +contained_float_set +contained_float_span +contained_float_spanset +contained_geo_set +contained_int_set +contained_int_span +contained_int_spanset +contained_npoint_set +contained_numspan_tnumber +contained_pose_set +contained_set_set +contained_span_span +contained_span_spanset +contained_spanset_span +contained_spanset_spanset +contained_stbox_stbox +contained_stbox_tspatial +contained_tbox_tbox +contained_tbox_tnumber +contained_temporal_temporal +contained_temporal_tstzspan +contained_text_set +contained_timestamptz_set +contained_timestamptz_span +contained_timestamptz_spanset +contained_tnumber_numspan +contained_tnumber_tbox +contained_tnumber_tnumber +contained_tspatial_stbox +contained_tspatial_tspatial +contained_tstzspan_temporal +contains_cbuffer_cbuffer +contains_numspan_tnumber +contains_set_bigint +contains_set_cbuffer +contains_set_date +contains_set_float +contains_set_geo +contains_set_int +contains_set_npoint +contains_set_pose +contains_set_set +contains_set_text +contains_set_timestamptz +contains_span_bigint +contains_span_date +contains_span_float +contains_span_int +contains_span_span +contains_span_spanset +contains_span_timestamptz +contains_spanset_bigint +contains_spanset_date +contains_spanset_float +contains_spanset_int +contains_spanset_span +contains_spanset_spanset +contains_spanset_timestamptz +contains_stbox_stbox +contains_stbox_tspatial +contains_tbox_tbox +contains_tbox_tnumber +contains_temporal_temporal +contains_temporal_tstzspan +contains_tnumber_numspan +contains_tnumber_tbox +contains_tnumber_tnumber +contains_tspatial_stbox +contains_tspatial_tspatial +contains_tstzspan_temporal +covers_cbuffer_cbuffer +date_extent_transfn +date_get_bin +date_to_set +date_to_span +date_to_spanset +date_to_timestamp +date_to_timestamptz +date_union_transfn +dateset_end_value +dateset_make +dateset_shift_scale +dateset_start_value +dateset_to_tstzset +dateset_value_n +dateset_values +datespan_bins +datespan_duration +datespan_lower +datespan_make +datespan_shift_scale +datespan_to_tstzspan +datespan_upper +datespanset_bins +datespanset_date_n +datespanset_dates +datespanset_duration +datespanset_end_date +datespanset_num_dates +datespanset_shift_scale +datespanset_start_date +datespanset_to_tstzspanset +disjoint_cbuffer_cbuffer +distance_bigintset_bigintset +distance_bigintspan_bigintspan +distance_bigintspanset_bigintspan +distance_bigintspanset_bigintspanset +distance_cbuffer_cbuffer +distance_cbuffer_geo +distance_cbuffer_stbox +distance_dateset_dateset +distance_datespan_datespan +distance_datespanset_datespan +distance_datespanset_datespanset +distance_floatset_floatset +distance_floatspan_floatspan +distance_floatspanset_floatspan +distance_floatspanset_floatspanset +distance_intset_intset +distance_intspan_intspan +distance_intspanset_intspan +distance_intspanset_intspanset +distance_pose_geo +distance_pose_pose +distance_pose_stbox +distance_set_bigint +distance_set_date +distance_set_float +distance_set_int +distance_set_timestamptz +distance_span_bigint +distance_span_date +distance_span_float +distance_span_int +distance_span_timestamptz +distance_spanset_bigint +distance_spanset_date +distance_spanset_float +distance_spanset_int +distance_spanset_timestamptz +distance_tstzset_tstzset +distance_tstzspan_tstzspan +distance_tstzspanset_tstzspan +distance_tstzspanset_tstzspanset +div_float_tfloat +div_int_tint +div_tfloat_float +div_tint_int +div_tnumber_tnumber +dwithin_cbuffer_cbuffer +econtains_cbuffer_tcbuffer +econtains_geo_tgeo +econtains_tcbuffer_cbuffer +econtains_tcbuffer_geo +econtains_tgeo_geo +econtains_tgeo_tgeo +ecovers_cbuffer_tcbuffer +ecovers_geo_tgeo +ecovers_tcbuffer_cbuffer +ecovers_tcbuffer_geo +ecovers_tcbuffer_tcbuffer +ecovers_tgeo_geo +ecovers_tgeo_tgeo +edisjoint_tcbuffer_cbuffer +edisjoint_tcbuffer_geo +edisjoint_tgeo_geo +edisjoint_tgeo_tgeo +edwithin_tcbuffer_cbuffer +edwithin_tcbuffer_geo +edwithin_tcbuffer_tcbuffer +edwithin_tgeo_geo +edwithin_tgeo_tgeo +eintersects_tcbuffer_cbuffer +eintersects_tcbuffer_geo +eintersects_tcbuffer_tcbuffer +eintersects_tgeo_geo +eintersects_tgeo_tgeo +etouches_tcbuffer_cbuffer +etouches_tcbuffer_geo +etouches_tcbuffer_tcbuffer +etouches_tgeo_geo +etouches_tgeo_tgeo +etouches_tpoint_geo +ever_eq_bool_tbool +ever_eq_cbuffer_tcbuffer +ever_eq_float_tfloat +ever_eq_geo_tgeo +ever_eq_geo_trgeometry +ever_eq_int_tint +ever_eq_npoint_tnpoint +ever_eq_pose_tpose +ever_eq_tbool_bool +ever_eq_tcbuffer_cbuffer +ever_eq_tcbuffer_tcbuffer +ever_eq_temporal_temporal +ever_eq_text_ttext +ever_eq_tfloat_float +ever_eq_tgeo_geo +ever_eq_tgeo_tgeo +ever_eq_tint_int +ever_eq_tnpoint_npoint +ever_eq_tnpoint_tnpoint +ever_eq_tpose_pose +ever_eq_tpose_tpose +ever_eq_trgeometry_geo +ever_eq_trgeometry_trgeometry +ever_eq_ttext_text +ever_ge_float_tfloat +ever_ge_int_tint +ever_ge_temporal_temporal +ever_ge_text_ttext +ever_ge_tfloat_float +ever_ge_tint_int +ever_ge_ttext_text +ever_gt_float_tfloat +ever_gt_int_tint +ever_gt_temporal_temporal +ever_gt_text_ttext +ever_gt_tfloat_float +ever_gt_tint_int +ever_gt_ttext_text +ever_le_float_tfloat +ever_le_int_tint +ever_le_temporal_temporal +ever_le_text_ttext +ever_le_tfloat_float +ever_le_tint_int +ever_le_ttext_text +ever_lt_float_tfloat +ever_lt_int_tint +ever_lt_temporal_temporal +ever_lt_text_ttext +ever_lt_tfloat_float +ever_lt_tint_int +ever_lt_ttext_text +ever_ne_bool_tbool +ever_ne_cbuffer_tcbuffer +ever_ne_float_tfloat +ever_ne_geo_tgeo +ever_ne_geo_trgeometry +ever_ne_int_tint +ever_ne_npoint_tnpoint +ever_ne_pose_tpose +ever_ne_tbool_bool +ever_ne_tcbuffer_cbuffer +ever_ne_tcbuffer_tcbuffer +ever_ne_temporal_temporal +ever_ne_text_ttext +ever_ne_tfloat_float +ever_ne_tgeo_geo +ever_ne_tgeo_tgeo +ever_ne_tint_int +ever_ne_tnpoint_npoint +ever_ne_tnpoint_tnpoint +ever_ne_tpose_pose +ever_ne_tpose_tpose +ever_ne_trgeometry_geo +ever_ne_trgeometry_trgeometry +ever_ne_ttext_text +float_angular_difference +float_degrees +float_exp +float_extent_transfn +float_get_bin +float_ln +float_log10 +float_round +float_timestamptz_to_tbox +float_to_set +float_to_span +float_to_spanset +float_to_tbox +float_tstzspan_to_tbox +float_union_transfn +floatset_ceil +floatset_degrees +floatset_end_value +floatset_floor +floatset_make +floatset_radians +floatset_shift_scale +floatset_start_value +floatset_to_intset +floatset_value_n +floatset_values +floatspan_bins +floatspan_ceil +floatspan_degrees +floatspan_expand +floatspan_floor +floatspan_lower +floatspan_make +floatspan_radians +floatspan_round +floatspan_shift_scale +floatspan_to_intspan +floatspan_upper +floatspan_width +floatspanset_bins +floatspanset_ceil +floatspanset_degrees +floatspanset_floor +floatspanset_lower +floatspanset_radians +floatspanset_round +floatspanset_shift_scale +floatspanset_to_intspanset +floatspanset_upper +floatspanset_width +front_stbox_stbox +front_stbox_tspatial +front_tspatial_stbox +front_tspatial_tspatial +gbox_make +gbox_to_stbox +geo_basetype +geo_cluster_dbscan +geo_cluster_intersecting +geo_cluster_kmeans +geo_cluster_within +geo_collect_garray +geo_copy +geo_equals +geo_geo_n +geo_is_empty +geo_is_unitary +geo_makeline_garray +geo_num_geos +geo_num_points +geo_pointarr +geo_points +geo_reverse +geo_round +geo_same +geo_set_srid +geo_split_each_n_stboxes +geo_split_n_stboxes +geo_srid +geo_stboxes +geo_timestamptz_to_stbox +geo_to_set +geo_to_stbox +geo_tpose_to_trgeometry +geo_transform +geo_transform_pipeline +geo_tstzspan_to_stbox +geo_typename +geo_union_transfn +geog_area +geog_centroid +geog_distance +geog_dwithin +geog_intersects +geog_length +geog_perimeter +geog_to_geom +geom_array_union +geom_azimuth +geom_boundary +geom_buffer +geom_centroid +geom_contains +geom_convex_hull +geom_covers +geom_difference2d +geom_disjoint2d +geom_distance2d +geom_distance3d +geom_dwithin2d +geom_dwithin3d +geom_intersection2d +geom_intersection2d_coll +geom_intersects2d +geom_intersects3d +geom_length +geom_min_bounding_radius +geom_perimeter +geom_relate_pattern +geom_shortestline2d +geom_shortestline3d +geom_to_cbuffer +geom_to_geog +geom_to_nsegment +geom_touches +geom_unary_union +geoset_end_value +geoset_make +geoset_start_value +geoset_type +geoset_value_n +geoset_values +get_srid_ways +int32_cmp +int64_cmp +int_extent_transfn +int_get_bin +int_timestamptz_to_tbox +int_to_set +int_to_span +int_to_spanset +int_to_tbox +int_tstzspan_to_tbox +int_union_transfn +interptype_name +intersection_bigint_set +intersection_date_set +intersection_float_set +intersection_geo_set +intersection_int_set +intersection_set_bigint +intersection_set_cbuffer +intersection_set_date +intersection_set_float +intersection_set_geo +intersection_set_int +intersection_set_npoint +intersection_set_pose +intersection_set_set +intersection_set_text +intersection_set_timestamptz +intersection_span_bigint +intersection_span_date +intersection_span_float +intersection_span_int +intersection_span_span +intersection_span_spanset +intersection_span_timestamptz +intersection_spanset_bigint +intersection_spanset_date +intersection_spanset_float +intersection_spanset_int +intersection_spanset_span +intersection_spanset_spanset +intersection_spanset_timestamptz +intersection_stbox_stbox +intersection_tbox_tbox +intersection_text_set +intersection_timestamptz_set +intersects_cbuffer_cbuffer +interval_make +intset_end_value +intset_make +intset_shift_scale +intset_start_value +intset_to_floatset +intset_value_n +intset_values +intspan_bins +intspan_expand +intspan_lower +intspan_make +intspan_shift_scale +intspan_to_floatspan +intspan_upper +intspan_width +intspanset_bins +intspanset_lower +intspanset_shift_scale +intspanset_to_floatspanset +intspanset_upper +intspanset_width +left_bigint_set +left_bigint_span +left_bigint_spanset +left_float_set +left_float_span +left_float_spanset +left_int_set +left_int_span +left_int_spanset +left_numspan_tnumber +left_set_bigint +left_set_float +left_set_int +left_set_set +left_set_text +left_span_bigint +left_span_float +left_span_int +left_span_span +left_span_spanset +left_spanset_bigint +left_spanset_float +left_spanset_int +left_spanset_span +left_spanset_spanset +left_stbox_stbox +left_stbox_tspatial +left_tbox_tbox +left_tbox_tnumber +left_text_set +left_tnumber_numspan +left_tnumber_tbox +left_tnumber_tnumber +left_tspatial_stbox +left_tspatial_tspatial +line_numpoints +lwproj_lookup +meosoper_name +minus_bigint_set +minus_bigint_span +minus_bigint_spanset +minus_cbuffer_set +minus_date_date +minus_date_int +minus_date_set +minus_date_span +minus_date_spanset +minus_float_set +minus_float_span +minus_float_spanset +minus_geo_set +minus_int_set +minus_int_span +minus_int_spanset +minus_npoint_set +minus_pose_set +minus_set_bigint +minus_set_cbuffer +minus_set_date +minus_set_float +minus_set_geo +minus_set_int +minus_set_npoint +minus_set_pose +minus_set_set +minus_set_text +minus_set_timestamptz +minus_span_bigint +minus_span_date +minus_span_float +minus_span_int +minus_span_span +minus_span_spanset +minus_span_timestamptz +minus_spanset_bigint +minus_spanset_date +minus_spanset_float +minus_spanset_int +minus_spanset_span +minus_spanset_spanset +minus_spanset_timestamptz +minus_text_set +minus_timestamptz_interval +minus_timestamptz_set +minus_timestamptz_span +minus_timestamptz_spanset +minus_timestamptz_timestamptz +mul_interval_double +nad_cbuffer_stbox +nad_stbox_geo +nad_stbox_stbox +nad_tboxfloat_tboxfloat +nad_tboxint_tboxint +nad_tcbuffer_cbuffer +nad_tcbuffer_geo +nad_tcbuffer_stbox +nad_tcbuffer_tcbuffer +nad_tfloat_float +nad_tfloat_tbox +nad_tfloat_tfloat +nad_tgeo_geo +nad_tgeo_stbox +nad_tgeo_tgeo +nad_tint_int +nad_tint_tbox +nad_tint_tint +nad_tnpoint_geo +nad_tnpoint_npoint +nad_tnpoint_stbox +nad_tnpoint_tnpoint +nad_tpose_geo +nad_tpose_pose +nad_tpose_stbox +nad_tpose_tpose +nad_trgeometry_geo +nad_trgeometry_stbox +nad_trgeometry_tpoint +nad_trgeometry_trgeometry +nai_tcbuffer_cbuffer +nai_tcbuffer_geo +nai_tcbuffer_tcbuffer +nai_tgeo_geo +nai_tgeo_tgeo +nai_tnpoint_geo +nai_tnpoint_npoint +nai_tnpoint_tnpoint +nai_tpose_geo +nai_tpose_pose +nai_tpose_tpose +nai_trgeometry_geo +nai_trgeometry_tpoint +nai_trgeometry_trgeometry +npoint_cmp +npoint_eq +npoint_ge +npoint_gt +npoint_hash +npoint_hash_extended +npoint_le +npoint_lt +npoint_make +npoint_ne +npoint_position +npoint_round +npoint_route +npoint_same +npoint_srid +npoint_timestamptz_to_stbox +npoint_to_geompoint +npoint_to_nsegment +npoint_to_set +npoint_to_stbox +npoint_tstzspan_to_stbox +npoint_union_transfn +npointset_end_value +npointset_make +npointset_routes +npointset_start_value +npointset_value_n +npointset_values +nsegment_cmp +nsegment_eq +nsegment_ge +nsegment_gt +nsegment_le +nsegment_lt +nsegment_make +nsegment_ne +nsegment_round +nsegment_route +nsegment_srid +nsegment_to_geom +nsegment_to_stbox +numset_type +numspan_basetype +numspan_timestamptz_to_tbox +numspan_tstzspan_to_tbox +numspan_type +overabove_stbox_stbox +overabove_stbox_tspatial +overabove_tspatial_stbox +overabove_tspatial_tspatial +overafter_date_set +overafter_date_span +overafter_date_spanset +overafter_set_date +overafter_set_timestamptz +overafter_span_date +overafter_span_timestamptz +overafter_spanset_date +overafter_spanset_timestamptz +overafter_stbox_stbox +overafter_stbox_tspatial +overafter_tbox_tbox +overafter_tbox_tnumber +overafter_temporal_temporal +overafter_temporal_tstzspan +overafter_timestamptz_set +overafter_timestamptz_span +overafter_timestamptz_spanset +overafter_tnumber_tbox +overafter_tnumber_tnumber +overafter_tspatial_stbox +overafter_tspatial_tspatial +overafter_tstzspan_temporal +overback_stbox_stbox +overback_stbox_tspatial +overback_tspatial_stbox +overback_tspatial_tspatial +overbefore_date_set +overbefore_date_span +overbefore_date_spanset +overbefore_set_date +overbefore_set_timestamptz +overbefore_span_date +overbefore_span_timestamptz +overbefore_spanset_date +overbefore_spanset_timestamptz +overbefore_stbox_stbox +overbefore_stbox_tspatial +overbefore_tbox_tbox +overbefore_tbox_tnumber +overbefore_temporal_temporal +overbefore_temporal_tstzspan +overbefore_timestamptz_set +overbefore_timestamptz_span +overbefore_timestamptz_spanset +overbefore_tnumber_tbox +overbefore_tnumber_tnumber +overbefore_tspatial_stbox +overbefore_tspatial_tspatial +overbefore_tstzspan_temporal +overbelow_stbox_stbox +overbelow_stbox_tspatial +overbelow_tspatial_stbox +overbelow_tspatial_tspatial +overfront_stbox_stbox +overfront_stbox_tspatial +overfront_tspatial_stbox +overfront_tspatial_tspatial +overlaps_numspan_tnumber +overlaps_set_set +overlaps_span_span +overlaps_span_spanset +overlaps_spanset_span +overlaps_spanset_spanset +overlaps_stbox_stbox +overlaps_stbox_tspatial +overlaps_tbox_tbox +overlaps_tbox_tnumber +overlaps_temporal_temporal +overlaps_temporal_tstzspan +overlaps_tnumber_numspan +overlaps_tnumber_tbox +overlaps_tnumber_tnumber +overlaps_tspatial_stbox +overlaps_tspatial_tspatial +overlaps_tstzspan_temporal +overleft_bigint_set +overleft_bigint_span +overleft_bigint_spanset +overleft_float_set +overleft_float_span +overleft_float_spanset +overleft_int_set +overleft_int_span +overleft_int_spanset +overleft_numspan_tnumber +overleft_set_bigint +overleft_set_float +overleft_set_int +overleft_set_set +overleft_set_text +overleft_span_bigint +overleft_span_float +overleft_span_int +overleft_span_span +overleft_span_spanset +overleft_spanset_bigint +overleft_spanset_float +overleft_spanset_int +overleft_spanset_span +overleft_spanset_spanset +overleft_stbox_stbox +overleft_stbox_tspatial +overleft_tbox_tbox +overleft_tbox_tnumber +overleft_text_set +overleft_tnumber_numspan +overleft_tnumber_tbox +overleft_tnumber_tnumber +overleft_tspatial_stbox +overleft_tspatial_tspatial +overright_bigint_set +overright_bigint_span +overright_bigint_spanset +overright_float_set +overright_float_span +overright_float_spanset +overright_int_set +overright_int_span +overright_int_spanset +overright_numspan_tnumber +overright_set_bigint +overright_set_float +overright_set_int +overright_set_set +overright_set_text +overright_span_bigint +overright_span_float +overright_span_int +overright_span_span +overright_span_spanset +overright_spanset_bigint +overright_spanset_float +overright_spanset_int +overright_spanset_span +overright_spanset_spanset +overright_stbox_stbox +overright_stbox_tspatial +overright_tbox_tbox +overright_tbox_tnumber +overright_text_set +overright_tnumber_numspan +overright_tnumber_tbox +overright_tnumber_tnumber +overright_tspatial_stbox +overright_tspatial_tspatial +pose_cmp +pose_copy +pose_eq +pose_ge +pose_gt +pose_hash +pose_hash_extended +pose_le +pose_lt +pose_make_2d +pose_make_3d +pose_make_point2d +pose_make_point3d +pose_ne +pose_nsame +pose_orientation +pose_rotation +pose_round +pose_same +pose_set_srid +pose_srid +pose_timestamptz_to_stbox +pose_to_point +pose_to_set +pose_to_stbox +pose_transform +pose_transform_pipeline +pose_tstzspan_to_stbox +pose_union_transfn +posearr_round +poseset_end_value +poseset_make +poseset_start_value +poseset_value_n +poseset_values +right_bigint_set +right_bigint_span +right_bigint_spanset +right_float_set +right_float_span +right_float_spanset +right_int_set +right_int_span +right_int_spanset +right_numspan_tnumber +right_set_bigint +right_set_float +right_set_int +right_set_set +right_set_text +right_span_bigint +right_span_float +right_span_int +right_span_span +right_span_spanset +right_spanset_bigint +right_spanset_float +right_spanset_int +right_spanset_span +right_spanset_spanset +right_stbox_stbox +right_stbox_tspatial +right_tbox_tbox +right_tbox_tnumber +right_text_set +right_tnumber_numspan +right_tnumber_tbox +right_tnumber_tnumber +right_tspatial_stbox +right_tspatial_tspatial +route_exists +route_length +same_numspan_tnumber +same_stbox_stbox +same_stbox_tspatial +same_tbox_tbox +same_tbox_tnumber +same_temporal_temporal +same_temporal_tstzspan +same_tnumber_numspan +same_tnumber_tbox +same_tnumber_tnumber +same_tspatial_stbox +same_tspatial_tspatial +same_tstzspan_temporal +set_basetype +set_cmp +set_copy +set_eq +set_extent_transfn +set_ge +set_gt +set_hash +set_hash_extended +set_le +set_lt +set_ne +set_num_values +set_round +set_spans +set_spantype +set_split_each_n_spans +set_split_n_spans +set_to_span +set_to_spanset +set_to_tbox +set_type +set_union_finalfn +set_union_transfn +shortestline_tcbuffer_cbuffer +shortestline_tcbuffer_geo +shortestline_tcbuffer_tcbuffer +shortestline_tgeo_geo +shortestline_tgeo_tgeo +shortestline_tnpoint_geo +shortestline_tnpoint_npoint +shortestline_tnpoint_tnpoint +shortestline_tpose_geo +shortestline_tpose_pose +shortestline_tpose_tpose +shortestline_trgeometry_geo +shortestline_trgeometry_tpoint +shortestline_trgeometry_trgeometry +span_basetype +span_canon_basetype +span_cmp +span_copy +span_eq +span_extent_transfn +span_ge +span_gt +span_hash +span_hash_extended +span_le +span_lower_inc +span_lt +span_ne +span_tbox_type +span_to_spanset +span_to_tbox +span_type +span_union_transfn +span_upper_inc +spanset_cmp +spanset_copy +spanset_end_span +spanset_eq +spanset_extent_transfn +spanset_ge +spanset_gt +spanset_hash +spanset_hash_extended +spanset_le +spanset_lower_inc +spanset_lt +spanset_make +spanset_ne +spanset_num_spans +spanset_span +spanset_span_n +spanset_spanarr +spanset_spans +spanset_split_each_n_spans +spanset_split_n_spans +spanset_start_span +spanset_to_tbox +spanset_type +spanset_union_finalfn +spanset_union_transfn +spanset_upper_inc +spatial_basetype +spatialset_srid +spatialset_to_stbox +spatialset_type +spheroid_init_from_srid +srid_is_latlong +stbox_area +stbox_cmp +stbox_copy +stbox_eq +stbox_expand_space +stbox_expand_time +stbox_ge +stbox_get_space +stbox_get_space_tile +stbox_get_space_time_tile +stbox_get_time_tile +stbox_gt +stbox_hash +stbox_hash_extended +stbox_hast +stbox_hasx +stbox_hasz +stbox_isgeodetic +stbox_le +stbox_lt +stbox_make +stbox_ne +stbox_perimeter +stbox_quad_split +stbox_round +stbox_set_srid +stbox_shift_scale_time +stbox_space_tiles +stbox_space_time_tiles +stbox_srid +stbox_time_tiles +stbox_tmax +stbox_tmax_inc +stbox_tmin +stbox_tmin_inc +stbox_to_box3d +stbox_to_gbox +stbox_to_geo +stbox_to_tstzspan +stbox_transform +stbox_transform_pipeline +stbox_volume +stbox_xmax +stbox_xmin +stbox_ymax +stbox_ymin +stbox_zmax +stbox_zmin +stboxarr_round +sub_float_tfloat +sub_int_tint +sub_tfloat_float +sub_tint_int +sub_tnumber_tnumber +talpha_type +talphanum_type +tbool_at_value +tbool_end_value +tbool_from_base_temp +tbool_minus_value +tbool_start_value +tbool_tand_transfn +tbool_to_tint +tbool_tor_transfn +tbool_value_at_timestamptz +tbool_value_n +tbool_values +tbool_when_true +tboolinst_make +tbox_cmp +tbox_copy +tbox_eq +tbox_expand_time +tbox_ge +tbox_gt +tbox_hash +tbox_hash_extended +tbox_hast +tbox_hasx +tbox_le +tbox_lt +tbox_make +tbox_ne +tbox_round +tbox_shift_scale_time +tbox_tmax +tbox_tmax_inc +tbox_tmin +tbox_tmin_inc +tbox_to_floatspan +tbox_to_intspan +tbox_to_tstzspan +tbox_xmax +tbox_xmax_inc +tbox_xmin +tbox_xmin_inc +tboxfloat_xmax +tboxfloat_xmin +tboxint_xmax +tboxint_xmin +tcbuffer_at_cbuffer +tcbuffer_at_geom +tcbuffer_at_stbox +tcbuffer_expand +tcbuffer_make +tcbuffer_minus_cbuffer +tcbuffer_minus_geom +tcbuffer_minus_stbox +tcbuffer_points +tcbuffer_radius +tcbuffer_to_tfloat +tcbuffer_to_tgeompoint +tcbuffer_trav_area +tcontains_cbuffer_tcbuffer +tcontains_geo_tcbuffer +tcontains_geo_tgeo +tcontains_tcbuffer_cbuffer +tcontains_tcbuffer_geo +tcontains_tcbuffer_tcbuffer +tcontains_tgeo_geo +tcontains_tgeo_tgeo +tcovers_cbuffer_tcbuffer +tcovers_geo_tcbuffer +tcovers_geo_tgeo +tcovers_tcbuffer_cbuffer +tcovers_tcbuffer_geo +tcovers_tcbuffer_tcbuffer +tcovers_tgeo_geo +tcovers_tgeo_tgeo +tdisjoint_cbuffer_tcbuffer +tdisjoint_geo_tcbuffer +tdisjoint_geo_tgeo +tdisjoint_tcbuffer_cbuffer +tdisjoint_tcbuffer_geo +tdisjoint_tcbuffer_tcbuffer +tdisjoint_tgeo_geo +tdisjoint_tgeo_tgeo +tdistance_tcbuffer_cbuffer +tdistance_tcbuffer_geo +tdistance_tcbuffer_tcbuffer +tdistance_tfloat_float +tdistance_tgeo_geo +tdistance_tgeo_tgeo +tdistance_tint_int +tdistance_tnpoint_npoint +tdistance_tnpoint_point +tdistance_tnpoint_tnpoint +tdistance_tnumber_tnumber +tdistance_tpose_point +tdistance_tpose_pose +tdistance_tpose_tpose +tdistance_trgeometry_geo +tdistance_trgeometry_tpoint +tdistance_trgeometry_trgeometry +tdwithin_geo_tcbuffer +tdwithin_geo_tgeo +tdwithin_tcbuffer_cbuffer +tdwithin_tcbuffer_geo +tdwithin_tcbuffer_tcbuffer +tdwithin_tgeo_geo +tdwithin_tgeo_tgeo +temparr_round +temporal_after_timestamptz +temporal_append_tinstant +temporal_append_tsequence +temporal_at_max +temporal_at_min +temporal_at_timestamptz +temporal_at_tstzset +temporal_at_tstzspan +temporal_at_tstzspanset +temporal_at_values +temporal_basetype +temporal_before_timestamptz +temporal_cmp +temporal_copy +temporal_delete_timestamptz +temporal_delete_tstzset +temporal_delete_tstzspan +temporal_delete_tstzspanset +temporal_derivative +temporal_duration +temporal_dyntimewarp_distance +temporal_dyntimewarp_path +temporal_end_instant +temporal_end_sequence +temporal_end_timestamptz +temporal_eq +temporal_extent_transfn +temporal_frechet_distance +temporal_frechet_path +temporal_ge +temporal_gt +temporal_hash +temporal_hausdorff_distance +temporal_insert +temporal_instant_n +temporal_instants +temporal_interp +temporal_le +temporal_lower_inc +temporal_lt +temporal_max_instant +temporal_merge +temporal_merge_array +temporal_merge_combinefn +temporal_merge_transfn +temporal_min_instant +temporal_minus_max +temporal_minus_min +temporal_minus_timestamptz +temporal_minus_tstzset +temporal_minus_tstzspan +temporal_minus_tstzspanset +temporal_minus_values +temporal_ne +temporal_num_instants +temporal_num_sequences +temporal_num_timestamps +temporal_round +temporal_scale_time +temporal_segm_duration +temporal_segments +temporal_sequence_n +temporal_sequences +temporal_set_interp +temporal_shift_scale_time +temporal_shift_time +temporal_simplify_dp +temporal_simplify_max_dist +temporal_simplify_min_dist +temporal_simplify_min_tdelta +temporal_spans +temporal_split_each_n_spans +temporal_split_n_spans +temporal_start_instant +temporal_start_sequence +temporal_start_timestamptz +temporal_stops +temporal_subtype +temporal_tagg_finalfn +temporal_tcount_transfn +temporal_time +temporal_time_bins +temporal_time_split +temporal_timestamps +temporal_timestamptz_n +temporal_to_tinstant +temporal_to_tsequence +temporal_to_tsequenceset +temporal_to_tstzspan +temporal_tprecision +temporal_tsample +temporal_type +temporal_update +temporal_upper_inc +tempsubtype_from_string +tempsubtype_name +teq_bool_tbool +teq_cbuffer_tcbuffer +teq_float_tfloat +teq_geo_tgeo +teq_geo_trgeometry +teq_int_tint +teq_pose_tpose +teq_tbool_bool +teq_tcbuffer_cbuffer +teq_temporal_temporal +teq_text_ttext +teq_tfloat_float +teq_tgeo_geo +teq_tint_int +teq_tnpoint_npoint +teq_tpose_pose +teq_trgeometry_geo +teq_ttext_text +text_cmp +text_copy +text_initcap +text_lower +text_to_set +text_union_transfn +text_upper +textcat_text_text +textcat_text_textset +textcat_text_ttext +textcat_textset_text +textcat_ttext_text +textcat_ttext_ttext +textset_end_value +textset_initcap +textset_lower +textset_make +textset_start_value +textset_upper +textset_value_n +textset_values +tfloat_at_value +tfloat_ceil +tfloat_degrees +tfloat_end_value +tfloat_exp +tfloat_floor +tfloat_from_base_temp +tfloat_ln +tfloat_log10 +tfloat_max_value +tfloat_min_value +tfloat_minus_value +tfloat_radians +tfloat_scale_value +tfloat_shift_scale_value +tfloat_shift_value +tfloat_start_value +tfloat_time_boxes +tfloat_tmax_transfn +tfloat_tmin_transfn +tfloat_to_tint +tfloat_tsum_transfn +tfloat_value_at_timestamptz +tfloat_value_bins +tfloat_value_boxes +tfloat_value_n +tfloat_value_split +tfloat_value_time_boxes +tfloat_value_time_split +tfloat_values +tfloat_wmax_transfn +tfloat_wmin_transfn +tfloat_wsum_transfn +tfloatbox_expand +tfloatbox_shift_scale +tfloatinst_make +tge_float_tfloat +tge_int_tint +tge_temporal_temporal +tge_text_ttext +tge_tfloat_float +tge_tint_int +tge_ttext_text +tgeo_affine +tgeo_at_geom +tgeo_at_stbox +tgeo_at_value +tgeo_centroid +tgeo_convex_hull +tgeo_end_value +tgeo_from_base_temp +tgeo_minus_geom +tgeo_minus_stbox +tgeo_minus_value +tgeo_scale +tgeo_space_boxes +tgeo_space_split +tgeo_space_time_boxes +tgeo_space_time_split +tgeo_split_each_n_stboxes +tgeo_split_n_stboxes +tgeo_start_value +tgeo_stboxes +tgeo_traversed_area +tgeo_type +tgeo_type_all +tgeo_value_at_timestamptz +tgeo_value_n +tgeo_values +tgeodetic_type +tgeogpoint_to_tgeography +tgeography_to_tgeogpoint +tgeography_to_tgeometry +tgeoinst_make +tgeometry_to_tcbuffer +tgeometry_to_tgeography +tgeometry_to_tgeompoint +tgeometry_type +tgeompoint_to_tgeometry +tgeompoint_to_tnpoint +tgt_float_tfloat +tgt_int_tint +tgt_temporal_temporal +tgt_text_ttext +tgt_tfloat_float +tgt_tint_int +tgt_ttext_text +time_type +timeset_type +timespan_basetype +timespan_type +timespanset_type +timestamp_to_date +timestamptz_extent_transfn +timestamptz_get_bin +timestamptz_shift +timestamptz_tcount_transfn +timestamptz_to_date +timestamptz_to_set +timestamptz_to_span +timestamptz_to_spanset +timestamptz_to_stbox +timestamptz_to_tbox +timestamptz_tprecision +timestamptz_union_transfn +tint_at_value +tint_end_value +tint_from_base_temp +tint_max_value +tint_min_value +tint_minus_value +tint_scale_value +tint_shift_scale_value +tint_shift_value +tint_start_value +tint_time_boxes +tint_tmax_transfn +tint_tmin_transfn +tint_to_tfloat +tint_tsum_transfn +tint_value_at_timestamptz +tint_value_bins +tint_value_boxes +tint_value_n +tint_value_split +tint_value_time_boxes +tint_value_time_split +tint_values +tint_wmax_transfn +tint_wmin_transfn +tint_wsum_transfn +tintbox_expand +tintbox_shift_scale +tintersects_cbuffer_tcbuffer +tintersects_geo_tcbuffer +tintersects_geo_tgeo +tintersects_tcbuffer_cbuffer +tintersects_tcbuffer_geo +tintersects_tcbuffer_tcbuffer +tintersects_tgeo_geo +tintersects_tgeo_tgeo +tintinst_make +tle_float_tfloat +tle_int_tint +tle_temporal_temporal +tle_text_ttext +tle_tfloat_float +tle_tint_int +tle_ttext_text +tlt_float_tfloat +tlt_int_tint +tlt_temporal_temporal +tlt_text_ttext +tlt_tfloat_float +tlt_tint_int +tlt_ttext_text +tne_bool_tbool +tne_cbuffer_tcbuffer +tne_float_tfloat +tne_geo_tgeo +tne_geo_trgeometry +tne_int_tint +tne_pose_tpose +tne_tbool_bool +tne_tcbuffer_cbuffer +tne_temporal_temporal +tne_text_ttext +tne_tfloat_float +tne_tgeo_geo +tne_tint_int +tne_tnpoint_npoint +tne_tpose_pose +tne_trgeometry_geo +tne_ttext_text +tnpoint_at_geom +tnpoint_at_npoint +tnpoint_at_npointset +tnpoint_at_stbox +tnpoint_cumulative_length +tnpoint_length +tnpoint_minus_geom +tnpoint_minus_npoint +tnpoint_minus_npointset +tnpoint_minus_stbox +tnpoint_positions +tnpoint_route +tnpoint_routes +tnpoint_speed +tnpoint_tcentroid_transfn +tnpoint_to_tgeompoint +tnpoint_trajectory +tnpoint_twcentroid +tnpointinst_make +tnumber_abs +tnumber_angular_difference +tnumber_at_span +tnumber_at_spanset +tnumber_at_tbox +tnumber_avg_value +tnumber_basetype +tnumber_delta_value +tnumber_extent_transfn +tnumber_integral +tnumber_minus_span +tnumber_minus_spanset +tnumber_minus_tbox +tnumber_spantype +tnumber_split_each_n_tboxes +tnumber_split_n_tboxes +tnumber_tavg_finalfn +tnumber_tavg_transfn +tnumber_tboxes +tnumber_to_span +tnumber_to_tbox +tnumber_trend +tnumber_twavg +tnumber_type +tnumber_valuespans +tnumber_wavg_transfn +touches_cbuffer_cbuffer +tpoint_angular_difference +tpoint_as_mvtgeom +tpoint_at_elevation +tpoint_at_geom +tpoint_at_value +tpoint_azimuth +tpoint_cumulative_length +tpoint_direction +tpoint_from_base_temp +tpoint_get_x +tpoint_get_y +tpoint_get_z +tpoint_is_simple +tpoint_length +tpoint_make_simple +tpoint_minus_elevation +tpoint_minus_geom +tpoint_minus_value +tpoint_speed +tpoint_tcentroid_finalfn +tpoint_tcentroid_transfn +tpoint_tfloat_to_geomeas +tpoint_trajectory +tpoint_twcentroid +tpoint_type +tpointinst_make +tpose_at_geom +tpose_at_pose +tpose_at_stbox +tpose_end_value +tpose_make +tpose_minus_geom +tpose_minus_pose +tpose_minus_stbox +tpose_points +tpose_rotation +tpose_start_value +tpose_to_tpoint +tpose_trajectory +tpose_value_at_timestamptz +tpose_value_n +tpose_values +trgeometry_after_timestamptz +trgeometry_append_tinstant +trgeometry_append_tsequence +trgeometry_before_timestamptz +trgeometry_delete_timestamptz +trgeometry_delete_tstzset +trgeometry_delete_tstzspan +trgeometry_delete_tstzspanset +trgeometry_end_instant +trgeometry_end_sequence +trgeometry_end_value +trgeometry_geom +trgeometry_instant_n +trgeometry_instants +trgeometry_points +trgeometry_restrict_timestamptz +trgeometry_restrict_tstzset +trgeometry_restrict_tstzspan +trgeometry_restrict_tstzspanset +trgeometry_restrict_value +trgeometry_restrict_values +trgeometry_rotation +trgeometry_round +trgeometry_segments +trgeometry_sequence_n +trgeometry_sequences +trgeometry_set_interp +trgeometry_start_instant +trgeometry_start_sequence +trgeometry_start_value +trgeometry_to_tinstant +trgeometry_to_tpoint +trgeometry_to_tpose +trgeometry_traversed_area +trgeometry_value_n +trgeometryinst_make +tsequenceset_make_gaps +tspatial_extent_transfn +tspatial_set_srid +tspatial_srid +tspatial_to_stbox +tspatial_transform +tspatial_transform_pipeline +tspatial_type +tstzset_end_value +tstzset_make +tstzset_shift_scale +tstzset_start_value +tstzset_tcount_transfn +tstzset_to_dateset +tstzset_to_stbox +tstzset_tprecision +tstzset_value_n +tstzset_values +tstzspan_bins +tstzspan_duration +tstzspan_expand +tstzspan_lower +tstzspan_make +tstzspan_shift_scale +tstzspan_tcount_transfn +tstzspan_to_datespan +tstzspan_to_stbox +tstzspan_tprecision +tstzspan_upper +tstzspanset_bins +tstzspanset_duration +tstzspanset_end_timestamptz +tstzspanset_lower +tstzspanset_num_timestamps +tstzspanset_shift_scale +tstzspanset_start_timestamptz +tstzspanset_tcount_transfn +tstzspanset_timestamps +tstzspanset_timestamptz_n +tstzspanset_to_datespanset +tstzspanset_to_stbox +tstzspanset_tprecision +tstzspanset_upper +ttext_at_value +ttext_end_value +ttext_from_base_temp +ttext_initcap +ttext_lower +ttext_max_value +ttext_min_value +ttext_minus_value +ttext_start_value +ttext_tmax_transfn +ttext_tmin_transfn +ttext_upper +ttext_value_at_timestamptz +ttext_value_n +ttext_values +ttextinst_make +ttouches_cbuffer_tcbuffer +ttouches_geo_tcbuffer +ttouches_geo_tgeo +ttouches_tcbuffer_cbuffer +ttouches_tcbuffer_geo +ttouches_tcbuffer_tcbuffer +ttouches_tgeo_geo +ttouches_tgeo_tgeo +type_span_bbox +union_bigint_set +union_bigint_span +union_bigint_spanset +union_date_set +union_date_span +union_date_spanset +union_float_set +union_float_span +union_float_spanset +union_geo_set +union_int_set +union_int_span +union_int_spanset +union_set_bigint +union_set_cbuffer +union_set_date +union_set_float +union_set_geo +union_set_int +union_set_npoint +union_set_pose +union_set_set +union_set_text +union_set_timestamptz +union_span_bigint +union_span_date +union_span_float +union_span_int +union_span_span +union_span_spanset +union_span_timestamptz +union_spanset_bigint +union_spanset_date +union_spanset_float +union_spanset_int +union_spanset_span +union_spanset_spanset +union_spanset_timestamptz +union_stbox_stbox +union_tbox_tbox +union_text_set +union_timestamptz_set +union_timestamptz_span +union_timestamptz_spanset diff --git a/tools/streaming_parity/feeds/type-catalog.txt b/tools/streaming_parity/feeds/type-catalog.txt new file mode 100644 index 0000000000..cd1d7b5d9a --- /dev/null +++ b/tools/streaming_parity/feeds/type-catalog.txt @@ -0,0 +1,52 @@ +# Type-catalog / introspection (47): real MEOS external-API functions present in +# the JMEOS binding (GeneratedFunctions), not emitted into the streaming facade +# (the codegen scopes to per-event operators). Each takes a single meosType/SRID +# int and returns type metadata; mostly trivially callable. They count as a +# facade gap until the codegen emits them. +alphanum_basetype +alphanum_temptype +alphanumset_type +basetype_byvalue +basetype_varlength +geo_basetype +geoset_type +interptype_name +lwproj_lookup +meosoper_name +numset_type +numspan_basetype +numspan_type +set_basetype +set_spantype +set_type +span_basetype +span_canon_basetype +span_tbox_type +span_type +spanset_type +spatial_basetype +spatialset_type +spheroid_init_from_srid +srid_check_latlong +srid_is_latlong +talpha_type +talphanum_type +temporal_basetype +temporal_type +tempsubtype_from_string +tempsubtype_name +tgeo_type +tgeo_type_all +tgeodetic_type +tgeometry_type +time_type +timeset_type +timespan_basetype +timespan_type +timespanset_type +tnumber_basetype +tnumber_spantype +tnumber_type +tpoint_type +tspatial_type +type_span_bbox diff --git a/tools/streaming_parity/streaming_parity.py b/tools/streaming_parity/streaming_parity.py new file mode 100644 index 0000000000..42d24e3b6b --- /dev/null +++ b/tools/streaming_parity/streaming_parity.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +"""Streaming-parity harness — PROVEN (measured, not guessed) coverage of the +MEOS function surface by a streaming platform (Flink / Kafka / NebulaStream). + +This is the streaming-platform sibling of MobilityDB's cross-type parity-audit +harness (`tools/parity_audit/`, MobilityDB #1110). Same discipline, different +axis: + + * parity_audit : does each temporal TYPE cover its family-reference's ops? + * streaming_parity: does each PLATFORM cover the *streamable* MEOS surface? + +THE FIX FOR "GUESSED 100%": a function is covered only when a test PASSES — not +because a generic wiring class *could* wrap it, and not because an operator is +registered. Coverage is measured at three layers (deepest reached wins): + + L1 EXPORTED — the MEOS symbol is exported by the pinned libmeos (`nm -D`). + L2 WIRED — the platform registers an operator/UDF that calls it + (Nebula: operator's `meos_call` + SQL token; Flink/Kafka: + a generated facade method — javap/reflection). + L3 PROVEN — a test exercising that operator/method passes green + (Nebula: a systest; Flink/Kafka: a JUnit). + +Only L3 counts toward TRUE parity. L2-only is reported separately as +"wired, unproven" so a future session knows exactly what still needs a test. + +NON-STREAMABLE tiers are reason-marked exclusions (the streaming sibling of the +semantic/structural exclusions in cross_type_parity.md) and never count as +gaps: + * io-meta — I/O / catalog / infra, not a domain operator. + * sequence-only — needs a whole completed sequence, not a per-event handle. + * internal — not part of the public API. + * ambiguous — open design question (the formal streamingSemantics RFC). + +Run against an ACCUMULATED-PR build of the platform (all open PRs merged), so +parity is measured against the full *intended* surface, not stale master. + +Usage: + streaming_parity.py --catalog streaming-relevance-baseline.json \ + --platform Nebula --feed nebula.feed.tsv [--baseline old.feed.tsv] + + feed.tsv rows: {proven|wired} +""" +from __future__ import annotations +import argparse +import json +from collections import Counter + +STREAMABLE = {"stateless", "bounded-state", "windowed", "cross-stream"} +# Reason-marked NON-streamable tiers: never gaps, never "implement to close". +NON_STREAMABLE_REASON = { + "io-meta": "I/O / catalog / infrastructure — not a streaming domain operator", + "sequence-only": "needs a whole completed sequence (not a per-event handle); " + "only reachable as a windowed closure-of-stream, tracked separately", + "internal": "not part of the public MEOS API", + "ambiguous": "open streaming-semantics design question (formal streamingSemantics RFC)", +} + + +def load_catalog(path): + """function name -> tier, restricted to public API (drop 'internal').""" + doc = json.load(open(path)) + rows = doc["functions"] if isinstance(doc, dict) else doc + return {r["name"]: r.get("tier", "internal") for r in rows} + + +def load_feed(path): + """function name -> depth ('proven' | 'wired'); 'proven' wins on dup.""" + feed = {} + for line in open(path): + p = line.rstrip("\n").split("\t") + if len(p) >= 2 and p[0]: + depth = p[1].strip().lower() + if depth not in ("proven", "wired"): + continue + if feed.get(p[0]) != "proven": + feed[p[0]] = depth + return feed + + +def measure(catalog, feed): + streamable = {n for n, t in catalog.items() if t in STREAMABLE} + proven = {n for n in streamable if feed.get(n) == "proven"} + wired = {n for n in streamable if feed.get(n) == "wired"} + gaps = streamable - proven - wired + # feed entries that aren't in the streamable catalog (extra / misnamed) + unknown = {n for n, d in feed.items() if n not in streamable} + return dict(streamable=streamable, proven=proven, wired=wired, gaps=gaps, + unknown=unknown) + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--catalog", required=True, help="streaming-relevance-baseline.json") + ap.add_argument("--platform", required=True) + ap.add_argument("--feed", required=True, help="TSV: function{proven|wired}") + ap.add_argument("--baseline", help="prior feed for a Δ column") + a = ap.parse_args() + + catalog = load_catalog(a.catalog) + m = measure(catalog, load_feed(a.feed)) + base = measure(catalog, load_feed(a.baseline)) if a.baseline else None + n_str = len(m["streamable"]) + + def pct(x): + return 100.0 * x / n_str if n_str else 0.0 + nprov, nwire, ngap = len(m["proven"]), len(m["wired"]), len(m["gaps"]) + bcol = " Δ callable |" if base else "" + print(f"# Streaming parity (CALLABLE, measured) — {a.platform}\n") + print(f"Streamable MEOS surface (public, tiers {sorted(STREAMABLE)}): **{n_str}**\n") + print("| layer | meaning | count | % of streamable |" + bcol) + print("|---|---|---|---|" + ("---|" if base else "")) + d = f" {pct(nprov) - pct(len(base['proven'])):+.1f} |" if base else "" + print(f"| **L3 CALLABLE** | binding invokes it on real libmeos | " + f"**{nprov}** | **{pct(nprov):.1f}%** |{d}") + print(f"| L2 wired-only | registered, not yet confirmed callable | " + f"{nwire} | {pct(nwire):.1f}% |" + (" |" if base else "")) + print(f"| gap | streamable, not wired | {ngap} | {pct(ngap):.1f}% |" + + (" |" if base else "")) + + print("\n## Non-streamable (reason-marked — NOT gaps, never implement to 'close')\n") + tally = Counter(t for t in catalog.values()) + for tier, reason in NON_STREAMABLE_REASON.items(): + if tier == "internal": + continue + print(f"- **{tier}** ({tally.get(tier, 0)}): {reason}") + + print("\n## L2 wired but UNCONFIRMED — needs a callability test to count (honest backlog)\n") + wired = sorted(m["wired"]) + head = ", ".join(wired[:40]) + (" …" if len(wired) > 40 else "") + print(f"{len(wired)} functions: " + head if wired else "(none)") + + print("\n## Real gaps — streamable, not wired on this platform (implement)\n") + for t in sorted(STREAMABLE): + gs = sorted(n for n in m["gaps"] if catalog[n] == t) + tail = (": " + ", ".join(gs[:20]) + (" …" if len(gs) > 20 else "")) if gs else "" + print(f"- **{t}** ({len(gs)})" + tail) + if m["unknown"]: + print(f"\n_note: {len(m['unknown'])} feed entries not in the streamable catalog " + f"(internal/io-meta/renamed): {', '.join(sorted(m['unknown'])[:15])}…_") + + +if __name__ == "__main__": + main()